cURL ??(7)? ???? ???? ??: ???? ??? ? ????.
P粉674999420
2023-08-20 16:21:20
<p>cUrl(php)? ???? ???? ??? xml ??? ? ???? ??? ????. localhost??? ??? ??? ???? ???? ???? ??? ?? ?????. </p>
<???>
<p>cURL ??(7): ???? ??? ? ????</p>
</???>
<p>? ??? ??? ????:</p>
<pre class="brush:php;toolbar:false;">?? xml_post($post_xml, $url)
{
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$ch = cur_init(); // ? ?? ???
?_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
?_setopt($ch, CURLOPT_URL, $url);
?_setopt($ch, CURLOPT_FAILONERROR, 1);
?_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
?_setopt($ch, CURLOPT_RETURNTRANSFER,1);
?_setopt($ch, CURLOPT_TIMEOUT, 50);
?_setopt($ch, CURLOPT_POSTFIELDS, $post_xml);
?_setopt($ch, CURLOPT_USERAGENT, $user_agent);
// ?_setopt($ch, CURLOPT_PORT, $port);
$data = ?_exec($ch);
$curl_errno = ?_errno($ch);
$curl_error = ?_??($ch);
if ($curl_errno > 0) {
echo "cURL ??($curl_errno): $curl_errorn";
} ? ?? {
echo "n?? ???? ?????";
}
?_??($ch);
?? $ ???;
}</pre>
<p>??? ?? ???? ??? ??? ???? ????? ????. ?? php 4+? php5+? ? ??? ?? ??? ???? ???? ?????. ???? ???? </p>
?? ?????... 無法連接到主機(jī)或代理。
? ?????
?? ??? ?? ????? ?????:
???
?? ???? ??? ???? 您的URL有誤
或您有一些防火墻
或限制
??? ? ????.
?? +0
P粉674999420