Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3663

Error (56): Failure when receiving data from the peer for rest API post method request using PHP

$
0
0

The Response should be XML, but I'm getting error like:

(56): Failure when receiving data from the peer

while sending the request to REST API using headers. Here is the sample request according to the client:

POST http://api.toyotautrust.in/1.0/olx/inventory HTTP/1.1User-Agent: FiddlerAuthorization: Token ******-****-****-****-***********Host: api.toyotautrust.inContent-Length: 52

Here is my Request code written in PHP using cURL

$headers1=['POST /1.0/olx/inventory HTTP/1.1','Host: api.toyotautrust.in','User-Agent: Fiddler','Authorization: Token' .$atoken1,'Content-Length: 52'];$ch1 = curl_init();curl_setopt($ch1, CURLOPT_URL, 'http://api.toyotautrust.in/1.0/olx/inventory');curl_setopt($ch1, CURLOPT_POST, true);curl_setopt($ch1, CURLOPT_HEADER, true);curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);curl_setopt($ch1, CURLOPT_HTTPHEADER,$headers1);$response1 = curl_exec($ch1);print_r($response1);$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);echo $status_code1;

Viewing all articles
Browse latest Browse all 3663

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>