0

I am sending the http header X-SSID, but server receives it as HTTP_X_SSID. I'm using cURL but it's not required; I just need to send this header by post method and get content.

Here's the code I'm using to make the request:

$ch = curl_init();

// ... other setup code; see link above for full context)

curl_setopt($ch, CURLOPT_HTTPHEADER, arrat(
  "X-SSID: {$ssid}",
  "X-API_VERSION: 2"
});

$server_output = curl_exec($ch);
var_dump($ssid, $server_output);
curl_close($ch);

Here's how the server sees the request:

["HTTP_X_SSID"]=>
string(32) "[truncated]"
["HTTP_X_API_VERSION"]=>
string(1) "2"
6
  • 1
    can you post the code you use to send this curl request? Commented Jan 20, 2019 at 9:03
  • @wodka, imgur.com/a/4DsV53A Commented Jan 20, 2019 at 9:24
  • and why do you now think that HTTP_X_SSID is sent to the server? Commented Jan 20, 2019 at 9:30
  • @wodka i sent once request to my server and checked it imgur.com/ol0zLwO Commented Jan 20, 2019 at 9:34
  • ah :) then please check my answer - this is just how received headers are exposed in php Commented Jan 20, 2019 at 9:36

1 Answer 1

2

If you are checking the headers in php please note that they are exposed like this.

ie sending X-test will produce a global var $HTTP_X_TEST

Sign up to request clarification or add additional context in comments.

1 Comment

ok that's confirming that problem with headers isn't in my script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.