Re: simple CFHTTP API question
site_archiver@lists.apple.com Delivered-To: macnetworkprog@lists.apple.com thanks! also, is there a function for URL encoding strings? "http://localhost/?q=%3D" i'd like it to automatically convert "=" into "%3D" thanks, augusto. On Aug 7, 2009, at 4:14 PM, Mark Pauley wrote: GET /?q=1 HTTP/1.1 <headers> <empty line> you might wish to take a look at http://www.w3.org/TR/html401/interact/forms.html On Aug 7, 2009, at 3:46 PM, augusto callejas wrote: hi- i want to make a GET request at "http://localhost/?q=1". is this the proper approach? thanks, augusto. _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/macnetworkprog/mpauley%40apple.com _Mark mpauley@apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/macnetworkprog/site_archiver%40lists.... i may want to include characters that are normally reserved, like equals sign: No you do not need to also add ?q=1 to the body, unless your server expects the inputs in a POST request. The code you listed below (after giving the URL to an CFHTTPMessage and creating an HTTPReadStream via the API) will send: to the server at localhost on port 80. I'm guessing that your server software will then parse the query string '?q=1' into something useful on your end. I believe this is query string is expected from a web browser when sending forms from html pages if a certain option (method = get) is set. which might clear things up. PHP commonly handles the parsing of either the POST with the inputs in the body data or the GET with the inputs in the url. CFStringRef url = CFSTR("http://localhost/?q=1"); CFURLRef myURL = CFURLCreateWithString(kCFAllocatorDefault, url, NULL); or do i need to encode the "q=1" portion into the body of the request? This email sent to mpauley@apple.com This email sent to site_archiver@lists.apple.com
participants (1)
-
augusto callejas