Code to access data on webpage
Hi I wonder if anyone can help me with what I am sure will just be a couple of lines of simple code.
I have a fairly big, for me, project using the propeller chip to control a digital slot car track. I have working lap counting & timing, VGA display, digital track drive & wireless throttles using the Nordic NRF24L01 chip. All that is working fine and I sort of understand what I am doing.
I have a one off need, and only a short time, to use the same project to access a web page to pick up Tweet information which will then be used to move the cars round the track. I am completely unfamiliar with web based stuff, hence this plea for help...
I want to use the Spinneret as I can hopefully use it to access the information and port all my existing code. I have got up and running Tim's "W5100 TCP Client Echo Demo, and can connect to the Simple.com tool. However I am at a complete loss as to what needs to be sent on a repetative basis to access the ascii string that will be updated with Tweet data.
This is the web address.
http://trademover.net/poweredbyrs/api/main.svc/GetLatest?getTime=true
I wonder if anyone could show me what to put where to access the information, using the Client Echo as a basis, or something else if that is more appropriate?
Many Thanks
Richard
I have a fairly big, for me, project using the propeller chip to control a digital slot car track. I have working lap counting & timing, VGA display, digital track drive & wireless throttles using the Nordic NRF24L01 chip. All that is working fine and I sort of understand what I am doing.
I have a one off need, and only a short time, to use the same project to access a web page to pick up Tweet information which will then be used to move the cars round the track. I am completely unfamiliar with web based stuff, hence this plea for help...
I want to use the Spinneret as I can hopefully use it to access the information and port all my existing code. I have got up and running Tim's "W5100 TCP Client Echo Demo, and can connect to the Simple.com tool. However I am at a complete loss as to what needs to be sent on a repetative basis to access the ascii string that will be updated with Tweet data.
This is the web address.
http://trademover.net/poweredbyrs/api/main.svc/GetLatest?getTime=true
I wonder if anyone could show me what to put where to access the information, using the Client Echo as a basis, or something else if that is more appropriate?
Many Thanks
Richard
Comments
You already have the couple of lines of simple code to complete the task. I imagine you're missing is the proper HTTP protocol to invoke the remote service.
The remote host ip:port for trademover.net is 81.95.51.4:80. Use the remote IP and port in the Spinneret initialization.
Below is the request header used to invoke the getTime service on the trademover.net domain.
Here is the response header and message body. The message body - the part you are looking for - is one line below the header.
As suggested in the response to your PM, the following tutorial briefly explains - with source code - how to invoke a remote HTTP GET.
http://spinneret.servebeer.com:5000/client/sget.htm
I can see from the code and response that you are able to access the data I need, so I will now go and try to work out where to use the Get command, to Get the same response.
As I don't want to start from scratch could you comment on using the TCP Client Echo Demo as a starting point, or is there a better Demo to use?
Thanks again
Richard
Update the remote host IP and remote port using the following values.
Make sure the local port number is large, 5000 is good
The Spinneret must have access to the Internet which means a router. There may be router configuration required.
Execute the request.