我在本地和服务器上运行相同的代码 . 但是,相同的代码在本地而不是服务器端运行 . 没有显示错误 .

$contents = '';
if (function_exists('curl_init'))
{   // first check with curl as we can set short timeout;
    $retry = 1;
    do {
                $check = _isCurl();
                //  display_error( _("version: " . $check));
        $ch = curl_init();
        curl_setopt ($ch, CURLOPT_URL, 'http://'.$site.$filename);
        curl_setopt ($ch, CURLOPT_COOKIEJAR, "$path_to_root/tmp/cookie.txt");
        curl_setopt ($ch, CURLOPT_HEADER, 0);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        // prevent warning while safe_mode/open_basedir on (redireciton doesn't occur at least on ECB page)
        if (!ini_get('safe_mode') && !ini_get('open_basedir'))
            curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt ($ch, CURLOPT_TIMEOUT, 3);
        $contents = curl_exec ($ch);
        curl_close($ch);
        // due to resolver bug in some curl versions (e.g. 7.15.5) 
        // try again for constant IP.
        if (isset($site_ip))
                    {
                       // display_error( _("in " . $site_ip));
            $site=$site_ip;
                    }

   } while( ($contents == '') && $retry--);

我试着运行curl_getinfo($ ch);

Locally

数组([url] => myURL [content_type] => text / xml [http_code] => 200 [header_size] => 237 [request_size] => 91 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [TOTAL_TIME] => 0.016 [namelookup_time] => 0.016 [CONNECT_TIME] => 0.016 [pretransfer_time] => 0.016 [size_upload] => 0 [size_download] => 1624 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => 0 [upload_content_length] => 0 [starttransfer_time] => 0.072781 [redirect_time] => 0)

Server

数组([url] => myURL [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 3.003278 [namelookup_time] => 7.0E- [connect_time] => 5 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => 0 [upload_content_length] => 0 [starttransfer_time] => 0.072781 [redirect_time] => 0)