CURL canlı sitede localhost çalışan değil

0 Cevap php

Ben uzak bir sunucudan bazı XML içeriğini getirir bir CURL kodu var. Ben (windows XAMPP) benim localhost beklenen çıkışı olsun. Ama (Linux üzerinde barındırılan) canlı sitesinden, ben CURL hatayı alıyorum: 'ana bilgisayara bağlanmak olamazdı'.

 function DownloadUrl($Url, $p){

// is curl installed? if (!function_exists('curl_init')){ die('CURL is not installed!'); }

   // create curl resource
    $ch = curl_init();

    // set url
    curl_setopt($ch, CURLOPT_URL, $Url);

curl_setopt ($ch, CURLOPT_POSTFIELDS, $p);
curl_setopt ($ch, CURLOPT_POST, 1);
    //return the transfer as a string
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    // $output contains the output string
    $output = curl_exec($ch);

if($output === false)
 echo 'Curl error: ' . curl_error($ch);
else
  print $output;
    // close curl resource to free up system resources
    curl_close($ch);          

}

0 Cevap