Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / October 2007



Tip: Looking for answers? Try searching our database.

http response text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mlabs - 11 Oct 2007 23:10 GMT
i'm trying to get just the response content, not the headers... from
an HTTP GET ... but CFReadStreamRead() seems to just give me the whole
lot... headers and all.....which probably makes sense, but how to I
extract just the content?

TIA
mlabs - 12 Oct 2007 03:52 GMT
figured it out, so in case anyone is interested..

you can create an empty response object and fill it with the incoming
bytes.. like so:

responseRef = CFHTTPMessageCreateEmpty(NULL, FALSE);

then use CFReadStreamRead in a loop to get the bytes into a temporary
buffer...

as you get the bytes you append them into the empty response object
like so:

CFHTTPMessageAppendBytes(responseRef, (UInt8*)bytes, nBytesRead);

then when all the bytes are in, you use the response object to get the
body content:

CFDataRef respData = CFHTTPMessageCopyBody(responseRef);

if there is a better way please post it
TIA
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.