Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-28-2011, 02:53 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 104
Shades of Chaos is on a distinguished road
Default http headers

Hey all

How do I access the http headers of a url. Is there a way to make a http sniffer in xcode?

Thanks
Shades of Chaos is offline   Reply With Quote
Old 06-28-2011, 03:12 PM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

in the didReceiveResponse: delegate method for NSURLConnection, you can use NSHTTPURLResponse to get the headers
smithdale87 is offline   Reply With Quote
Old 06-28-2011, 03:33 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 104
Shades of Chaos is on a distinguished road
Default

Hey thanks for the quick response. I googled what you said and it lead me to this tutorial iLessons iLearned: How to Debug NSURLConnection HTTP Headers

This worked quite well and gave me Cache-Control, Connection, Content-Type, Date, Server, and Transfer-Encoding. But isn't there something that tells me a number like "200 ok" in the header.

Thanks

I believe the "200 ok" is called a statusCode but when I add
NSLog(@"%@", [httpResponse statusCode]);
The app crashes with writing nothing to the console

Last edited by Shades of Chaos; 06-28-2011 at 03:38 PM. Reason: New info
Shades of Chaos is offline   Reply With Quote
Old 06-28-2011, 03:48 PM   #4 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 104
Shades of Chaos is on a distinguished road
Default

Hey I think I fixed it. I thought that the NSLog would print out a string something like "status-code" = "200" so I put a %@ in my NSLog. But I changed it to a %d and it worked and printed out 200.

Thanks for all the help
Shades of Chaos is offline   Reply With Quote
Reply

Bookmarks

Tags
access, headers, http, internet, url

Thread Tools
Display Modes

Posting 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



» Advertisements
» Online Users: 327
7 members and 320 guests
chemistry, iOS.Lover, lendo, leostc, Leslie80, pbart, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:30 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0