HTML request
Draugar
Posts: 27
Hi, I have some issues getting this code to work. I am trying to get info as .XML, but I don't recieve anything. No Online or string events, I do get a onerror timeout event after some seconds. Opening a connection through telnet on port 80 and typing in the GET request, I get the information I want, so the request is correct, but it wont send it. I have tried forcing it by waiting x ammount of time but it cant send because the connection isn't opened. I have tried going with the www.yr.no IP as well. Any ideas?
The information and policy cna be found at http://om.yr.no/verdata/xml/spesifikasjon/ (in norwegian)
The information and policy cna be found at http://om.yr.no/verdata/xml/spesifikasjon/ (in norwegian)
PROGRAM_NAME='dvYr' DEFINE_VARIABLE CHAR sYRBuffer[5000] INTEGER Test1, Test2, Test3, Test4 DEFINE_START CREATE_BUFFER dvYR, sYRBuffer DEFINE_EVENT BUTTON_EVENT[dvPanel,123] { PUSH: { SEND_STRING 0,"'IP_CLIENT_OPEN(dvYR.port,www.yr.no,80,IP_TCP)'" IP_CLIENT_OPEN(dvYR.port,'www.yr.no',80,IP_TCP) SEND_STRING 0,"'Test1 = TRUE'" Test1 = TRUE } } BUTTON_EVENT[dvPanel,124] { PUSH: { SEND_STRING 0,"'IP_CLIENT_CLOSE(dvYR.port)'" IP_CLIENT_CLOSE(dvYR.port) } } DATA_EVENT[dvYR] { ONLINE: { SEND_STRING 0,"'GET /sted/Norge/Akershus/Ski/Ski/varsel.xml HTTP/1.1',$0D,$0A,'HOST: www.yr.no',$0D,$0A,$0D,$0A" SEND_STRING dvYR,"'GET /sted/Norge/Akershus/Ski/Ski/varsel.xml HTTP/1.1',$0D,$0A,'HOST: www.yr.no',$0D,$0A,$0D,$0A" SEND_STRING 0,"'Test2 = TRUE'" Test2 = TRUE } ONERROR: { SEND_STRING 0,"'***TRACE - IP CONNECTION FAILURE***'" SWITCH(data.number) { CASE 2:{SEND_STRING 0,"'Error Connecting',$0A,'2:General Failure(Out of Memory)'"} CASE 4:{SEND_STRING 0,"'Error Connecting',$0A,'4:Unknown host'"} CASE 6:{SEND_STRING 0,"'Error Connecting',$0A,'6:Connection refused'"} CASE 7:{SEND_STRING 0,"'Error Connecting',$0A,'7:Connection timed out'"} CASE 8:{SEND_STRING 0,"'Error Connecting',$0A,'8:Unknown connection error'"} CASE 9:{SEND_STRING 0,"'Error Connecting',$0A,'9:Already closed'"} CASE 14:{SEND_STRING 0,"'Error Connecting',$0A,'14:Local port already used'"} CASE 16:{SEND_STRING 0,"'Error Connecting',$0A,'16:Too many open sockets'"} CASE 17:{SEND_STRING 0,"'Error Connecting',$0A,'17:Local Port Not Open'"} DEFAULT:{SEND_STRING 0,"'Error Connecting',$0A,'17:Local Port Not Open'"} } } STRING: { SEND_STRING 0,"'String received!'" SEND_STRING 0,"sYRBuffer" SELECT { ACTIVE(FIND_STRING(sYRBuffer,'HTTP/1.1 200 OK',1)): { STACK_VAR INTEGER nHeaderEnd STACK_VAR CHAR sHeader[300] STACK_VAR CHAR sBody[100] SEND_STRING 0,"'Test3 = TRUE'" Test3 = TRUE nHeaderEnd = FIND_STRING(sYRBuffer,"$0D,$0A,$0D,$0A",1) sHeader = GET_BUFFER_STRING(sYRBuffer,nHeaderEnd) GET_BUFFER_STRING(sYRBuffer,3) sBody = GET_BUFFER_STRING(sYRBuffer,LENGTH_ARRAY(sYRBuffer)) SEND_COMMAND 0,"sHeader" SEND_COMMAND 0,"sBody" IP_CLIENT_CLOSE(dvYR.port) SEND_STRING 0,"'Test4 = TRUE'" Test4 = TRUE } } } }
0
Comments
2) Are the DNS settings for the AMX master set correctly?
The DNS Entry 1 is set to 192.168.1.1, the same as my computer shown with IPCONFIG
My issue were the Gateway IP, wich were set to 192.168.1.0, and not the correct 192.168.1.1. Thank you Joe for giving me something to tripple check!