HTTP POST with custom header from iphone to PHP script. How do you read the header?


HTTP POST with custom header from iphone to PHP script. How do you read the header?



This code works, and I can see the request go out to my php script through charles with my custom header GUID attached.

NSMutableURLRequest *loginRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:feedURLString]];     	NSData *myRequestData = [NSData dataWithBytes:[myRequestString UTF8String]length:[myRequestString length]];  	[ loginRequest setHTTPMethod: @"POST" ]; 	[ loginRequest setHTTPBody: myRequestData ]; 	[ loginRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"]; 	[ loginRequest setValue:@"testdatainguid" forHTTPHeaderField:@"GUID" ]; 

In php, I tried to read the header

    if(isset($_SERVER['GUID'])) {     echo($_SERVER['GUID']); } 

I don't get any response. I tried getheaders, $_POST, $_GET and anything else I could think of, but I can't seem to get that data in my php. Any help would be greatly appreciated.


How to lose margin/padding in UITextView?

1:

Creating a PHP Webservice with binary-encoded parameters?
I'd expect it in $_SERVER['HTTP_GUID'], as another HTTP headers are.. Is there an iPhone SDK API for twitter? [closed]
iPhone Safari: Scroll a list inside a html containeriphone: making a new UIImage from data from an XML document

2:

What's the best way of learning iPhone programming when coming from Java?
You must always print_r($_SERVER) to figure out if it's being set, and/or find out how it's being set.. -didSelectRowAtIndexPath: not being called
Why do I have to clean up memory if I have an IBOutlet with “retain”, but not when I have one with “assign”?

40 out of 100 based on 10 user ratings 740 reviews