Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSURL redirect

NSURL redirect
Thread Tools
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Apr 18, 2003, 01:24 PM
 
I'm using NSURL to fecth html data off of NWS. One of the problems I'm running into is that I need to find out when NSURL is doing the right thing and following redirects, and what page I'm being redirected to. I've had no success in doing this so far. Does anyone know?

Thanks,
Matt Fahrenbacher
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Apr 19, 2003, 09:51 AM
 
One work around I've found is to simply use NSTask and curl. But now I have new problem!

When you do a search on weather.com (and most weather sites), sometimes you'll be taken to a page with multiple hits, or in the case of a unique hit, straight to the cities weather page.

There are two Peoria's in the weather.com database, so doing this:

curl "http://www.weather.com/search/search?where=Peoria"

works fine.

There is only one Champaign, but doing this:

url "http://www.weather.com/search/search?where=Champaign"

prints nothing to the screen. I played with the -F flag a little bit, but didn't get anywhere.

Does anyone see what I'm doing wrong?

Thanks,
Matt Fahrenbacher
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Apr 19, 2003, 11:47 PM
 
Check the output for this:

curl -I 'http://www.weather.com/search/search?where=Peoria'

This will show you the headers sent by the server; note the "Location:" header.
[Wevah setPostCount:[Wevah postCount] + 1];
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Apr 20, 2003, 08:56 AM
 
Originally posted by Wevah:
Check the output for this:

curl -I 'http://www.weather.com/search/search?where=Peoria'

This will show you the headers sent by the server; note the "Location:" header.
That was the trick I figured out yesterday, thanks!

Matt Fahrenbacher
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Apr 20, 2003, 09:44 PM
 
Hey Matt...

You might want to check out CURLHandle if you haven't already.

It seems like it might be a little more flexible/faster/whatever than using NSTask and all that.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:25 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2