本文整理汇总了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);
}