Wont connect
davidv
Posts: 90
<code>
Define_Function Tide_Client_Connection()
{
//Ip_Client_Open(dvDevice1.Port,'tidesandcurrents.noaa.gov',80,1)
IP_CLIENT_OPEN(dvDevice1.port,'www.tides.info',80,1)
Wait 10
{
Tide_Get_The Data_Pacmanstyle()
}
}
Define_Function Tide_Get_The Data_Pacmanstyle()
{
//http://www.tides.info/?command=rss&location=Boston%2c+Massachusetts
Send_String dvDevice1,"'GET /?command=rss&location=Boston%2c+Massachusetts',CRLF"
Send_String dvDevice1,"'Host: www.tides.info',CRLF"
Send_String dvDevice1,"'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.5',CRLF"
Send_String dvDevice1,"'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',CRLF"
Send_String dvDevice1,"CRLF"
}
DEFINE_START
Create_Buffer dvdevice1,cString
Tide_Client_Connection()
Modified_Date = "ITOA(DATE_TO_YEAR(LDATE)),'-',ITOA(DATE_TO_MONTH(LDATE)),'-',ITOA(DATE_TO_DAY(LDATE))";
</code>
I keep getting an error when I try to connect to the website. Does it have to do with the %2c+ within the Get command???
Define_Function Tide_Client_Connection()
{
//Ip_Client_Open(dvDevice1.Port,'tidesandcurrents.noaa.gov',80,1)
IP_CLIENT_OPEN(dvDevice1.port,'www.tides.info',80,1)
Wait 10
{
Tide_Get_The Data_Pacmanstyle()
}
}
Define_Function Tide_Get_The Data_Pacmanstyle()
{
//http://www.tides.info/?command=rss&location=Boston%2c+Massachusetts
Send_String dvDevice1,"'GET /?command=rss&location=Boston%2c+Massachusetts',CRLF"
Send_String dvDevice1,"'Host: www.tides.info',CRLF"
Send_String dvDevice1,"'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.5',CRLF"
Send_String dvDevice1,"'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7',CRLF"
Send_String dvDevice1,"CRLF"
}
DEFINE_START
Create_Buffer dvdevice1,cString
Tide_Client_Connection()
Modified_Date = "ITOA(DATE_TO_YEAR(LDATE)),'-',ITOA(DATE_TO_MONTH(LDATE)),'-',ITOA(DATE_TO_DAY(LDATE))";
</code>
I keep getting an error when I try to connect to the website. Does it have to do with the %2c+ within the Get command???
0
Comments
I would think you'd not want to break up the string being sent as you do.
Here's how I do it.
Try that instead -- you missed the HTTP/1.0 on the end. The %2c is the URL encoding for a comma. (note that $2C = comma)
Breaking the request into multiple lines won't hurt anything -- the server will wait until it sees the double newline at the end of the request to process it.
Its working now thanks. I must have missed that. I am still new to AMX programming.