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
php curl php-curl
add a comment |
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
php curl php-curl
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
add a comment |
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
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 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
add a comment |
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
add a comment |
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;
}
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
add a comment |
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;
}
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
add a comment |
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;
}
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
add a comment |
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;
}
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 at 7:51
jmarkatti
8418
8418
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
add a comment |
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
add a comment |
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 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