New topic: Trying to trace URL re-directs
<http://forums.realsoftware.com/viewtopic.php?t=45983> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message dscl Post subject: Trying to trace URL re-directsPosted: Mon Nov 19, 2012 1:41 pm Joined: Fri Apr 30, 2010 11:02 am Posts: 23 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 charonn0 Post subject: Re: Trying to trace URL re-directsPosted: Mon Nov 19, 2012 1:57 pm Joined: Mon Apr 02, 2007 2:08 am Posts: 1014 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 _________________ Boredom Software Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
