cocoa touch - How do I create an HTTP connection and log in on the iPhone? -


I am trying to log in to my website (www.trailbehind.com) and then upload a file I am sending a post request for.

I tried to apply some code to request a home page without authentication, which I found here:

However, even that code is not working Does, and I'm not sure what to do next. Here's the code that I tried to request for home page:

  CFRringRF URL = CFRR ("http://www.trailbehind.com/"); CFralArfMyral = CFLCriteWithString (kcfalokter default, url, noise); CFStringRef request method = CFSTR ("GET"); CFHTTPMessageRef myRequest = CFHTTPMessageCreateRequest (kcfaloceter default, request method, myURL, kcfttp wers1 1); CFStringRef bodyData = CFR (""); // Generally used for data data CFHTTPMessageSetBody (myRequest, bodyData); CFStringRef headerFieldName = CFRR ("X-My-Favorite Field"); CFStringRef Headerfield Values ​​= CFR ("Dreams"); CFHTTPMessageSetHeaderFieldValue (myRequest, HeaderFieldName, headerFieldValue); CFDataRef mySerializedRequest = CFHTP MessageCaplymised Message (myRequest); // Get the page CFReadStreamRef myReadStream = CF ReadStream CreativeFireHTML5 (KCFAALOcteter Default, MyReist); CFReadStreamOpen (myReadStream); CFHTTPMessageRef myResponse = CFReadStreamCopyProperty (myReadStream, kCFStreamPropertyHTTPResponseHeader); UInt32 myErrCode = CFHTTPMessageGetResponseStatusCode (myResponse); NSLog (@ "% @", MySpons); CFRelease (myRequest); CFRelease (myURL); CFRelease (url); CFRelease (mySerializedRequest); MyRequest = NULL; MySerializedRequest = NULL; Take a look at  

Quick and dirty is very easy for HTTP work.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -