Home AMX User Forum NetLinx Studio

Web Page Redirect?

Thought it would be cool to have a quote of the day come up on panel backgrounds. Actually having a hard time finding quote of the day websites. The main one that comes up apparently returns a "302". Which I guess is a redirect. Anyone know how to work this?

Sending:

BUTTON_EVENT [vdvTP,1250] // Query Quote
{
PUSH:
{
IP_CLIENT_OPEN(dvQuote.Port,'www.brainyquote.com',80,IP_TCP)
}
}



DATA_EVENT[dvQuote]
{
ONLINE: (* Socket connected *)
{
SEND_STRING dvQuote, "'GET /quotes_of_the_day.html HTTP/1.1',13,10"
SEND_STRING dvQuote, "'Host: brainyquote.com',13,10"
SEND_STRING dvQuote, "'Authorization: Basic',13,10"
SEND_STRING dvQuote, "'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',13,10"
SEND_STRING dvQuote, "13,10"
}
}


Receiving:

HTTP/1.1 302 Moved Temporarily
Date: Thu, 30 Jul 2015 04:21:05 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=d42b81b0768f8204556834deb894e4b531438230065; expires=Fri, 29-Jul-16 04:21:05 GMT; path=/; domain=.brainyquote.com; HttpOnly
Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Thu, 01 Jan 1970 00:00:01 GMT
Location: http://www.brainyquote.com/quotes_of_the_day.html
Server: cloudflare-nginx
CF-RAY: 20de465649060430-ORD.....

Thanks for any ideas!

Comments

  • GregGGregG Posts: 251
    Most likely the problem is because you are askiling for the link from brainyquote.com, but their server wants you to get it from www.brainyquote.com. So change your online event Host: header line to this:
    SEND_STRING dvQuote, "'Host: www.brainyquote.com',13,10"
    
    And then you shouldn't get the 302.
  • Yup, that was it! Thank you sir!
Sign In or Register to comment.