PHP Send Request Header not Sent Response NULL
i have a problem when send request header to my restful, my restful checking request Authorize header, but when i send the header is missing.
My restful debug give me result NULL
i was tried to add CURLOPT_SSL_VERIFYPEER but also not working ,
anyone can help me out ?
here is my code :
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_URL => "https://mysitehttps.domain",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gWrnContent-Disposition: form-data; name="asdasd"rnrnrn------WebKitFormBoundary7MA4YWxkTrZu0gW--",
CURLOPT_HTTPHEADER => array(
"Authorization: 123HaHaHa",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"postman-token: 3b3fd06d-a8aa-65db-a917-c911fa0bb5d5"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err)
echo "cURL Error #:" . $err;
else
echo $response;
Thank you
php curl php-curl
add a comment |
i have a problem when send request header to my restful, my restful checking request Authorize header, but when i send the header is missing.
My restful debug give me result NULL
i was tried to add CURLOPT_SSL_VERIFYPEER but also not working ,
anyone can help me out ?
here is my code :
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_URL => "https://mysitehttps.domain",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gWrnContent-Disposition: form-data; name="asdasd"rnrnrn------WebKitFormBoundary7MA4YWxkTrZu0gW--",
CURLOPT_HTTPHEADER => array(
"Authorization: 123HaHaHa",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"postman-token: 3b3fd06d-a8aa-65db-a917-c911fa0bb5d5"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err)
echo "cURL Error #:" . $err;
else
echo $response;
Thank you
php curl php-curl
did you try to CURLOPT_SSL_VERIFYPEER => true?
– Josua Marcel Chrisano
Nov 11 '18 at 7:33
yes, but didn't work , any idea for solving it sir ?
– Not a Pwntester
Nov 11 '18 at 7:34
may i know your real url and all the code??
– Josua Marcel Chrisano
Nov 12 '18 at 13:07
add a comment |
i have a problem when send request header to my restful, my restful checking request Authorize header, but when i send the header is missing.
My restful debug give me result NULL
i was tried to add CURLOPT_SSL_VERIFYPEER but also not working ,
anyone can help me out ?
here is my code :
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_URL => "https://mysitehttps.domain",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gWrnContent-Disposition: form-data; name="asdasd"rnrnrn------WebKitFormBoundary7MA4YWxkTrZu0gW--",
CURLOPT_HTTPHEADER => array(
"Authorization: 123HaHaHa",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"postman-token: 3b3fd06d-a8aa-65db-a917-c911fa0bb5d5"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err)
echo "cURL Error #:" . $err;
else
echo $response;
Thank you
php curl php-curl
i have a problem when send request header to my restful, my restful checking request Authorize header, but when i send the header is missing.
My restful debug give me result NULL
i was tried to add CURLOPT_SSL_VERIFYPEER but also not working ,
anyone can help me out ?
here is my code :
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_URL => "https://mysitehttps.domain",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gWrnContent-Disposition: form-data; name="asdasd"rnrnrn------WebKitFormBoundary7MA4YWxkTrZu0gW--",
CURLOPT_HTTPHEADER => array(
"Authorization: 123HaHaHa",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"postman-token: 3b3fd06d-a8aa-65db-a917-c911fa0bb5d5"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err)
echo "cURL Error #:" . $err;
else
echo $response;
Thank you
php curl php-curl
php curl php-curl
asked Nov 11 '18 at 7:31
Not a PwntesterNot a Pwntester
105
105
did you try to CURLOPT_SSL_VERIFYPEER => true?
– Josua Marcel Chrisano
Nov 11 '18 at 7:33
yes, but didn't work , any idea for solving it sir ?
– Not a Pwntester
Nov 11 '18 at 7:34
may i know your real url and all the code??
– Josua Marcel Chrisano
Nov 12 '18 at 13:07
add a comment |
did you try to CURLOPT_SSL_VERIFYPEER => true?
– Josua Marcel Chrisano
Nov 11 '18 at 7:33
yes, but didn't work , any idea for solving it sir ?
– Not a Pwntester
Nov 11 '18 at 7:34
may i know your real url and all the code??
– Josua Marcel Chrisano
Nov 12 '18 at 13:07
did you try to CURLOPT_SSL_VERIFYPEER => true?
– Josua Marcel Chrisano
Nov 11 '18 at 7:33
did you try to CURLOPT_SSL_VERIFYPEER => true?
– Josua Marcel Chrisano
Nov 11 '18 at 7:33
yes, but didn't work , any idea for solving it sir ?
– Not a Pwntester
Nov 11 '18 at 7:34
yes, but didn't work , any idea for solving it sir ?
– Not a Pwntester
Nov 11 '18 at 7:34
may i know your real url and all the code??
– Josua Marcel Chrisano
Nov 12 '18 at 13:07
may i know your real url and all the code??
– Josua Marcel Chrisano
Nov 12 '18 at 13:07
add a comment |
1 Answer
1
active
oldest
votes
I have tested this code and its working for me.
Your content-type is set to multi-part. Are you sure its not json. anyway try the code below
//initialize data variables that you want to send as post below
$data = array("name" => "Hagrid", "age" => "36");
$data_string = json_encode($data);
$ch = curl_init('https://mysitehttps.domain');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
//'Content-Type: application/json',
'Content-Length: ' . strlen($data_string),
"Authorization: 123HaHaHa",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"postman-token: 3b3fd06d-a8aa-65db-a917-c911fa0bb5d5"
)
);
$response = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if ($err)
echo "cURL Error #:" . $err;
else
echo $response;
still not working sir
– Not a Pwntester
Nov 11 '18 at 7:59
what is it that you are posting, Can we have the full code of yours so that i can better find the solution
– jmarkatti
Nov 11 '18 at 8:02
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246709%2fphp-send-request-header-not-sent-response-null%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have tested this code and its working for me.
Your content-type is set to multi-part. Are you sure its not json. anyway try the code below
//initialize data variables that you want to send as post below
$data = array("name" => "Hagrid", "age" => "36");
$data_string = json_encode($data);
$ch = curl_init('https://mysitehttps.domain');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
//'Content-Type: application/json',
'Content-Length: ' . strlen($data_string),
"Authorization: 123HaHaHa",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"postman-token: 3b3fd06d-a8aa-65db-a917-c911fa0bb5d5"
)
);
$response = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if ($err)
echo "cURL Error #:" . $err;
else
echo $response;
still not working sir
– Not a Pwntester
Nov 11 '18 at 7:59
what is it that you are posting, Can we have the full code of yours so that i can better find the solution
– jmarkatti
Nov 11 '18 at 8:02
add a comment |
I have tested this code and its working for me.
Your content-type is set to multi-part. Are you sure its not json. anyway try the code below
//initialize data variables that you want to send as post below
$data = array("name" => "Hagrid", "age" => "36");
$data_string = json_encode($data);
$ch = curl_init('https://mysitehttps.domain');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
//'Content-Type: application/json',
'Content-Length: ' . strlen($data_string),
"Authorization: 123HaHaHa",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"postman-token: 3b3fd06d-a8aa-65db-a917-c911fa0bb5d5"
)
);
$response = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if ($err)
echo "cURL Error #:" . $err;
else
echo $response;
still not working sir
– Not a Pwntester
Nov 11 '18 at 7:59
what is it that you are posting, Can we have the full code of yours so that i can better find the solution
– jmarkatti
Nov 11 '18 at 8:02
add a comment |
I have tested this code and its working for me.
Your content-type is set to multi-part. Are you sure its not json. anyway try the code below
//initialize data variables that you want to send as post below
$data = array("name" => "Hagrid", "age" => "36");
$data_string = json_encode($data);
$ch = curl_init('https://mysitehttps.domain');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
//'Content-Type: application/json',
'Content-Length: ' . strlen($data_string),
"Authorization: 123HaHaHa",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"postman-token: 3b3fd06d-a8aa-65db-a917-c911fa0bb5d5"
)
);
$response = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if ($err)
echo "cURL Error #:" . $err;
else
echo $response;
I have tested this code and its working for me.
Your content-type is set to multi-part. Are you sure its not json. anyway try the code below
//initialize data variables that you want to send as post below
$data = array("name" => "Hagrid", "age" => "36");
$data_string = json_encode($data);
$ch = curl_init('https://mysitehttps.domain');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
//'Content-Type: application/json',
'Content-Length: ' . strlen($data_string),
"Authorization: 123HaHaHa",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW",
"postman-token: 3b3fd06d-a8aa-65db-a917-c911fa0bb5d5"
)
);
$response = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if ($err)
echo "cURL Error #:" . $err;
else
echo $response;
answered Nov 11 '18 at 7:51
jmarkattijmarkatti
15019
15019
still not working sir
– Not a Pwntester
Nov 11 '18 at 7:59
what is it that you are posting, Can we have the full code of yours so that i can better find the solution
– jmarkatti
Nov 11 '18 at 8:02
add a comment |
still not working sir
– Not a Pwntester
Nov 11 '18 at 7:59
what is it that you are posting, Can we have the full code of yours so that i can better find the solution
– jmarkatti
Nov 11 '18 at 8:02
still not working sir
– Not a Pwntester
Nov 11 '18 at 7:59
still not working sir
– Not a Pwntester
Nov 11 '18 at 7:59
what is it that you are posting, Can we have the full code of yours so that i can better find the solution
– jmarkatti
Nov 11 '18 at 8:02
what is it that you are posting, Can we have the full code of yours so that i can better find the solution
– jmarkatti
Nov 11 '18 at 8:02
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246709%2fphp-send-request-header-not-sent-response-null%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
did you try to CURLOPT_SSL_VERIFYPEER => true?
– Josua Marcel Chrisano
Nov 11 '18 at 7:33
yes, but didn't work , any idea for solving it sir ?
– Not a Pwntester
Nov 11 '18 at 7:34
may i know your real url and all the code??
– Josua Marcel Chrisano
Nov 12 '18 at 13:07