Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Oct 21, 2018 12:29 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Trying to trace URL re-directs
PostPosted: Mon Nov 19, 2012 1:41 pm 
Offline

Joined: Fri Apr 30, 2010 11:02 am
Posts: 25
What I'm trying to do, at a very basic level, is take a URL and verify that the URL does not redirect. If it does I need to get at the end url. So for example if you put

http://www.kmart.com/shc/s/v_10151_1010 ... lectronics?

in your browser you actually end up at

http://www.kmart.com/tvs-electronics/v-1231469079?rdc=y

(I have no affiliation with kmart btw)

What I need to do is have a text box to put the first URL, resolve it, and get the second URL. Looking through the examples included with RealStudio 2011R2 I have found the following projects and their behavior...

HTTP Example
If I enter the first URL in and press 'GO' the result returns back what appears to be binary?

SimpleWebBrowser
If I enter the first URL the resulting page properly loads, but the URL bar is not updated to reflect the new URL

HTMLViewer
If I enter the first URL the resulting page properly loads, but the URL bar is not updated to reflect the new URL

Win32 Web Browser
Finally, the not only does the correct content load, but the URL bar IS updated with the new and correct URL

The problem is that last example I can't make heads or tales of... Additionally I don't even need to see the rendered page contents... just the final location URL. Does anyone know how I could do this?

Thanks!


Top
 Profile  
Reply with quote  
 Post subject: Re: Trying to trace URL re-directs
PostPosted: Mon Nov 19, 2012 1:57 pm 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
Location: San Francisco, CA, USA
HTTP redirects are detectable in the HTTPSocket's HeadersReceived event. A Redirect would likely use an HTTPStatus of 301 or 302. In a 301 or 302 redirect, the Headers passed to the HeadersReceived event contain a value called "Location" which is the URL to redirect to.

For example, here's the raw HTTP transaction with that KMart URL:

Request:
Quote:
GET /shc/s/v_10151_10104_Computers+%26+Electronics HTTP/1.1
Host: http://www.kmart.com
Connection: keep-alive


Response:
Quote:
HTTP/1.1 301 Moved Permanently
Location: /tvs-electronics/v-1231469079?rdc=y


Example project

_________________
Boredom Software


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group