apache - server doesn't respond on POST Request with CURL + PHP -
i have simple php script, uses curl send http post request remote server.
$ch = curl_init(); curl_setopt($ch, curlopt_url, 'http://91.250.77.10/test.php'); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, array('a' => 'b')); curl_setopt($ch, curlopt_returntransfer, 1); $contents = curl_exec($ch); $error = curl_error($ch); curl_close($ch); if ($error) echo $error; else echo $contents;
this results in error: "no response server". request can't found in access log of remote server, too!
what's more, if send postfields querystring, i.e.:
curl_setopt($ch, curlopt_postfields, '&a=b');
then fine.
it seems wrong apache or php configuration on remote server. hints?
edit:
as now, looks server doesn't accept (or correctly handle) requests content-type: multipart/form-data (curl uses type when setting array postfields, not when setting string.)
since need send file request, have use multipart/form-data. how server correctly handle this?
if pass array curlopt_postfields
form submitted multipart/form-data
there possibility remote end not accepting encoding type.
Comments
Post a Comment