本文整理匯總了PHP中ccurl::ParseError方法的典型用法代碼示例。如果您正苦於以下問題:PHP ccurl::ParseError方法的具體用法?PHP ccurl::ParseError怎麽用?PHP ccurl::ParseError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ccurl
的用法示例。
在下文中一共展示了ccurl::ParseError方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: test_auth_perform
function test_auth_perform()
{
$tpl = new templates();
$SquidBinIpaddr = $_POST["TESTPROXYIP"];
if ($SquidBinIpaddr == "0.0.0.0") {
$SquidBinIpaddr = "127.0.0.1";
}
$port = $_POST["TESTPROXYPORT"];
$TESTAUTHPASS = url_decode_special_tool($_POST["TESTAUTHPASS"]);
$TESTAUTHUSER = stripslashes($_POST["TESTAUTHUSER"]);
$array["BIND"] = $_POST["TESTAUTHBIND"];
$array["PROXY"] = $_POST["TESTAUTHPROXY"];
$array["USER"] = $TESTAUTHUSER;
$array["PASS"] = $TESTAUTHPASS;
@file_put_contents("/usr/share/artica-postfix/ressources/conf/upload/NTLM_TESTS", serialize($array));
$sock = new sockets();
$sock->getFrameWork("squid.php?test-ntlm=yes");
$ch = curl_init();
curl_setopt($ch, CURLOPT_INTERFACE, $_POST["TESTAUTHBIND"]);
curl_setopt($ch, CURLOPT_URL, "http://www.google.com");
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Pragma: no-cache", "Cache-Control: no-cache"));
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, FALSE);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_PROXY, "{$_POST["TESTAUTHPROXY"]}");
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
echo "Bind..........: {$_POST["TESTAUTHBIND"]}\n";
echo "Proxy.........: {$_POST["TESTAUTHPROXY"]}\n";
//curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
//curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $TESTAUTHUSER . ':' . $TESTAUTHPASS);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ch, CURLOPT_NOBODY, true);
$data = curl_exec($ch);
if (preg_match("#X-Squid-Error:.*?([A-Z\\_]+)#is", $data, $re)) {
echo "**** FAILED WITH ERROR \"{$re[1]}\" ***\n\n";
}
if (preg_match("#Proxy-Authenticate: NTLM\\s+(.*?)\\s+#", $data, $re)) {
$data = str_replace($re[1], "***", $data);
}
$error = curl_errno($ch);
$curl = new ccurl(null);
if (!$curl->ParseError($error)) {
echo $error_text = $tpl->javascript_parse_text($curl->error) . "\n";
}
$info = curl_getinfo($ch);
curl_close($ch);
if (is_array($info)) {
while (list($num, $ligne) = each($info)) {
$infos[] = "{$num}: {$ligne}";
}
}
$sep = "\n------------------------------------------------------\n";
echo "http://www.google.com return error {$error}{$sep} Datas:{$sep}{$data}\nInfos:{$sep}" . @implode("\n", $infos);
}