CULL -Fehler: leere Antwort vom ServerPhp

PHP-Programmierer chatten hier
Anonymous
 CULL -Fehler: leere Antwort vom Server

Post by Anonymous »

Ich versuche, einen Curl -Post zu machen und einige Probleme zu begegnen. Wenn ich nur wenige Postleitzahlen poste, funktioniert es perfekt. Wenn ich eine größere Liste von Postleitzahlen einbrachte, schlägt sie mit der leeren Antwort aus dem Serverfehler fehl. < /P>

private function sendApiRequest($action, $request)
{
// Testing
$request['Test'] = $this->apitest;

// Build URL
$postURL = "{$this->apiurl}?Key={$this->apikey}&API_Action={$action}";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $postURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($request));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$resp = curl_exec($ch);

if(curl_errno($ch))
{
var_dump(curl_getinfo($ch));
throw new Exception('Curl Error: ' . curl_error($ch));
}
curl_close($ch);
return $resp;
}
< /code>

Hier ist der curl_getInfo () Dump: < /p>

array
'url' => string 'https://api.example.com/api.php?Key=xxx ... tFilterSet' (length=147)
'content_type' => null
'http_code' => int 0
'header_size' => int 0
'request_size' => int 11736
'filetime' => int -1
'ssl_verify_result' => int 20
'redirect_count' => int 0
'total_time' => float 0.374
'namelookup_time' => float 0
'connect_time' => float 0.093
'pretransfer_time' => float 0.203
'size_upload' => float 11486
'size_download' => float 0
'speed_download' => float 0
'speed_upload' => float 30711
'download_content_length' => float -1
'upload_content_length' => float 11486
'starttransfer_time' => float 0.374
'redirect_time' => float 0
'certinfo' =>
array
empty
'redirect_url' => string '' (length=0)
< /code>

Wie ich bereits sagte, eignet es sich perfekt für kleinere Anfragen, jedoch Fehler bei großen Anforderungen. < /P.>

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post