$url = 'http://www.baidu.com'; $options = array( CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_HEADER => 'true' ); $params = $this->makeSign($requestBody); Default_Service_Common::logErrorByFiles('xxx params =' . var_export($params, true), 'logs.log'); if (strtoupper($requestType) == 'GET') { $url = $this->serverUrl . '?' . http_build_query($params); } else { $options[CURLOPT_POSTFIELDS] = $params; $url = $this->serverUrl; } $options[CURLOPT_URL] = $url; //initialise a CURL session $connection = curl_init(); curl_setopt_array($connection, $options); $response = curl_exec($connection); $error = curl_errno($connection); $error_message = curl_error($connection); $httpStatus = curl_getinfo($connection, CURLINFO_HTTP_CODE); $headerSize = curl_getinfo($connection, CURLINFO_HEADER_SIZE); //close the connection curl_close($connection); $str = var_export(array($error_message, $httpStatus, $headerSize, $response), true); Default_Service_Common::logErrorByFiles('xxx-> response:'.$str, 'logs.log');
日誌報錯 :php
Couldn\'t resolve host xxxx
服務器
查詢得知須要禁用ipv 6 模塊session
lsmod |grep ipv6; #/存在則已經開啓了ipv六、無數據就說明禁用了
curl
或者ui
ifconfig 命令查看信息是否有 "inet6 addr : ...."信息 、有則也說明開啓了ipv6
this
ipv6關閉方法url
在/etc/modprobe.d/dist.conf結尾添加日誌
alias net-pf-10 off
alias ipv6 offcode
保存、重啓服務器、 問題解決
server
查看系統發行版本命令
cat /etc/issue
cat /proc/version