views:

643

answers:

2

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.

+3  A: 

I'd expect it in $_SERVER['HTTP_GUID'], as other HTTP headers are.

VoteyDisciple
Basically I tried calling it "HTTP_GUID" inside the objective c code then looking for that inside the php, or I tried calling it GUID and looking for GUID, I didn't understand that the HTTP_ was added automatically. Thanks for your quick reply. Saved me a few hours. Much appreciated.
Angelfilm Entertainment
A: 

You can always print_r($_SERVER) to figure out if it's being set, and/or find out how it's being set.

Brad