国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

php - win7 64位元 curl_exec($ch) 傳回一直是false
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-05-16 13:11:03
0
2
1418

同事的win10上面可以得到正常的值,但是在我在win7上curl_exec($ch)的回傳值一直是false。然後試著打出curl_error($ch)是一個string(0) ""。

我看了下本地php的設(shè)定 curl應(yīng)該已經(jīng)開啟了


之後我照著

http://php.net/manual/zh/curl...

下面的方法將
libeay32.dll
libssh2.dll
ssleay32.dll

這三個文件放到

C:\Program Files\Apache Software Foundation\Apache2.4\bin

這個目錄下,重啟apache之後得到的還是為false。

我的php版本是5.6.23。並且已經(jīng)基本上排除了程式碼的問題。想問各位有沒有也遇過類似情況的,最後都怎麼解決的。感激不盡。

下面是詳細(xì)程式碼。

$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    $headers=array(
        // 'W-ACCESS-TOKEN: '.$access_token,
        'Content-Type: application/json'
    );
    // addd header
    curl_setopt($ch, CURLOPT_HTTPHEADER, array_merge($headers,$app_headers));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
    // curl_setopt($ch, CURLOPT_COOKIE, implode(';', $cookies_items));
    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);

    if($method=='PUT'){
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
    }elseif($method=='DELETE'){
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
    }
    
    $data = curl_exec($ch);
    curl_close($ch);
    return $data;

再次更新,現(xiàn)在捕獲異常之後報出以下錯誤

Curl failed with error #7: Failed to connect to auc.qa2.test.yiran.com port 80: Timed out


4月21日更新
已解決。
沒有配host。配上了就能連上了。

PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證高級PHP講師

全部回覆(2)
巴扎黑

timeout就是連不上,你試試手動打開這個url看看。 。

習(xí)慣沉默

將程式碼貼出來,curl_setopt是否設(shè)定CURLOPT_RETURNTRANSFER為true

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板