Home AMX User Forum NetLinx Studio

RSS problem

I am trying my first IP connection and I keep getting an http 404 error. So here is what I have going on. I get a successful connection to the site then I try to GET the rss info and receive the 404 error.

I have tried the GET statement with the full url of http://sports.espn.com/espn/rss/news and as below with the resource
DEFINE_FUNCTION CHAR fnConnectRSS()
{
    IF (nESPNDebug)
    {
	SEND_STRING 0,"'Time ',Time,' - Updating ESPN RSS!',ITOA(__LINE__),'>',crlf" 
    }
    IP_CLIENT_OPEN (dvESPN.Port,'http://sports.espn.go.com',80,1) //ok for rss/xml and html //
     
    RETURN TRUE 
}

DEFINE_FUNCTION CHAR fnGetRSS()
{
    IF (nESPNDebug)
    {
	SEND_STRING 0, "'RSS Connected! line-<',ITOA(__LINE__),'>',crlf"
    }
    SEND_STRING dvESPN, "'GET /espn/rss/news',' HTTP/1.0',
			    crlf,'Connection: Close',crlf,crlf"

    SEND_STRING dvESPN,"'Host: http://sports.espn.go.com',crlf"  // ok for rss/xml and html
    SEND_STRING dvESPN,"crlf" 
    IF (nESPNDebug)
    {
	SEND_STRING 0, "'ESPN RSS Get Request Sent: line -<', ITOA(__LINE__),'>',crlf"
    }
    RETURN TRUE
}

Line 1 (15:20:20):: Refresh Sent
Line 2 (15:20:20):: Time 14:20:19 - Updating ESPN RSS!33>$0D$0A
Line 3 (15:20:20):: Memory Available = 35937440 <57368>
Line 4 (15:22:50):: Connected Successfully
Line 5 (15:22:50):: CIpEvent::OnLine 0:8:1
Line 6 (15:22:50):: RSS Connected! line-<44>$0D$0A
Line 7 (15:22:50):: ESPN RSS Get Request Sent: line -<53>$0D$0A
Line 8 (15:22:52):: Memory Available = 35855184 <82256>
Line 9 (15:22:52):: 14:22:51.699 EVENT Started HttpContext[/]
Line 10 (15:22:52):: Memory Available = 35823376 <31808>
Line 11 (15:22:53):: Exiting TCP Read thread - closing this socket for local port 8
Line 12 (15:22:53):: Memory Available = 35775576 <47800>
Line 13 (15:22:53):: No RSS captured:491 bytes from server! line-<120>
Line 14 (15:22:53):: Not sent to Parse
Line 15 (15:22:53):: SendString 0:0:0 too long 283 truncated to 274
Line 16 (15:22:53):: RSS Buffer = HTTP/1.1 404 %2Fespn%2Frss%2Fnews+Not+Found$0D$0ADate: Wed, 15 Apr 2009 14:22:51 GMT$0D$0AServer: Jetty/4.2.x (VxWorks/WIND ve
Line 17 (15:22:53):: RSS Buffer = ews+Not+Found</title>$0A<body>$0A<h2>HTTP ERROR: 404 %2Fespn%2Frss%2Fnews+Not+Found</h2>$0A<p>RequestURI=/espn/rss/news</p>$0A
Line 18 (15:22:53):: CIpEvent::OffLine 0:8:1

Comments

  • DHawthorneDHawthorne Posts: 4,584
    First of all, I think you may need the entire file path in the GET line, including the index file name. Second, you can't have the double "crlf" before the Host line. The double crlf will disconnect you before the rest of the header is sent; it's also possible they require more than the Host, but a user-agent, etc. You may have to play around with that one. I wouldn't expect a 404 error for the latter, but a 403 though, which is why I suggest adding the entire file name to the URL in your GET.
  • Joe HebertJoe Hebert Posts: 2,159
    I am trying my first IP connection and I keep getting an http 404 error. So here is what I have going on. I get a successful connection to the site then I try to GET the rss info and receive the 404 error.

    You need to ditch the http colon whack whack so try changing this:
    IP_CLIENT_OPEN (dvESPN.Port,'http://sports.espn.go.com',80,1)     
    

    To this:
    IP_CLIENT_OPEN (dvESPN.Port,'sports.espn.go.com',80,1) 
    

    The only SEND_STRING dvESPN you need is your first one:
        SEND_STRING dvESPN, "'GET /espn/rss/news',' HTTP/1.0',
    			    crlf,'Connection: Close',crlf,crlf"
    
    

    DHawthorne wrote:
    First of all, I think you may need the entire file path in the GET line, including the index file name.
    I don?t think that?s true. The GET the way he has it should return whatever the default file is which in this case should be the RSS data.
  • Joe - Thank you - works fine now - now time to work on my parsing.
  • viningvining Posts: 4,368
    Joe Hebert wrote:
    The only SEND_STRING dvESPN you need is your first one:
        SEND_STRING dvESPN, "'GET /espn/rss/news',' HTTP/1.0',
    			    crlf,'Connection: Close',crlf,crlf"
    
    That's obviously true since mncchartier now has it working but the other strings could be left in and work if as Dave mentioned the second "crlf" above was removed. That's signals end of transmission. That was supposed to be taken care of by the 3rd send_string in fnGetRSS() of the original code.

    Actually that may not be true since mncchartier put 'Connection: Close' in the 1st send_string. The original, original code didn't have that in there.
Sign In or Register to comment.