-2

I was wondering how to set an HTTPHEADER in Objective C.

In PHP, my code looks like :

    $headers = array(
            'Sign: '.$sign,
            'Key: '.$key,
            );
     //I send it with curl

    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

I tried a few things but I'm not able to create the array that is made by PHP so my request get refused by the server.

Does anyone have an idea ?

Bzh2610
  • 15
  • 5
  • Paste in the code that's not working. – esqew Aug 08 '14 at 18:49
  • 1
    Apple's documentation is really awesome: [setValue:forHTTPHeaderField:](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSMutableURLRequest_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMutableURLRequest/setValue:forHTTPHeaderField:) – Alex Aug 08 '14 at 18:50
  • See [setAllHTTPHeaderFields:](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSMutableURLRequest_Class/Reference/Reference.html#//apple_ref/occ/instm/NSMutableURLRequest/setAllHTTPHeaderFields:) – zaph Aug 08 '14 at 18:52
  • I guess I should read more Apple documentation. Sorry for the inconvenience. – Bzh2610 Aug 08 '14 at 19:00

1 Answers1

2

yes you can withe

[theRequest setValue:@"value" forHTTPHeaderField:@"Sign"];

similar question

Community
  • 1
  • 1
Idan Magled
  • 2,186
  • 1
  • 23
  • 33