PHP Send Request Header not Sent Response NULL









up vote
0
down vote

favorite












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










share|improve this question





















  • did you try to CURLOPT_SSL_VERIFYPEER => true?
    – Josua Marcel Chrisano
    Nov 11 at 7:33










  • yes, but didn't work , any idea for solving it sir ?
    – Not a Pwntester
    Nov 11 at 7:34











  • may i know your real url and all the code??
    – Josua Marcel Chrisano
    Nov 12 at 13:07














up vote
0
down vote

favorite












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










share|improve this question





















  • did you try to CURLOPT_SSL_VERIFYPEER => true?
    – Josua Marcel Chrisano
    Nov 11 at 7:33










  • yes, but didn't work , any idea for solving it sir ?
    – Not a Pwntester
    Nov 11 at 7:34











  • may i know your real url and all the code??
    – Josua Marcel Chrisano
    Nov 12 at 13:07












up vote
0
down vote

favorite









up vote
0
down vote

favorite











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










share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 7:31









Not a Pwntester

105




105











  • did you try to CURLOPT_SSL_VERIFYPEER => true?
    – Josua Marcel Chrisano
    Nov 11 at 7:33










  • yes, but didn't work , any idea for solving it sir ?
    – Not a Pwntester
    Nov 11 at 7:34











  • may i know your real url and all the code??
    – Josua Marcel Chrisano
    Nov 12 at 13:07
















  • did you try to CURLOPT_SSL_VERIFYPEER => true?
    – Josua Marcel Chrisano
    Nov 11 at 7:33










  • yes, but didn't work , any idea for solving it sir ?
    – Not a Pwntester
    Nov 11 at 7:34











  • may i know your real url and all the code??
    – Josua Marcel Chrisano
    Nov 12 at 13:07















did you try to CURLOPT_SSL_VERIFYPEER => true?
– Josua Marcel Chrisano
Nov 11 at 7:33




did you try to CURLOPT_SSL_VERIFYPEER => true?
– Josua Marcel Chrisano
Nov 11 at 7:33












yes, but didn't work , any idea for solving it sir ?
– Not a Pwntester
Nov 11 at 7:34





yes, but didn't work , any idea for solving it sir ?
– Not a Pwntester
Nov 11 at 7:34













may i know your real url and all the code??
– Josua Marcel Chrisano
Nov 12 at 13:07




may i know your real url and all the code??
– Josua Marcel Chrisano
Nov 12 at 13:07












1 Answer
1






active

oldest

votes

















up vote
0
down vote













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;






share|improve this answer




















  • still not working sir
    – Not a Pwntester
    Nov 11 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 at 8:02










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',
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
);



);













draft saved

draft discarded


















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








up vote
0
down vote













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;






share|improve this answer




















  • still not working sir
    – Not a Pwntester
    Nov 11 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 at 8:02














up vote
0
down vote













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;






share|improve this answer




















  • still not working sir
    – Not a Pwntester
    Nov 11 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 at 8:02












up vote
0
down vote










up vote
0
down vote









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;






share|improve this answer












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;







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 7:51









jmarkatti

8618




8618











  • still not working sir
    – Not a Pwntester
    Nov 11 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 at 8:02
















  • still not working sir
    – Not a Pwntester
    Nov 11 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 at 8:02















still not working sir
– Not a Pwntester
Nov 11 at 7:59




still not working sir
– Not a Pwntester
Nov 11 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 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 at 8:02

















draft saved

draft discarded
















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線