0
使用PHP和cURL,我想检查我是否可以使用提供的用户凭证登录到网站。为此,我正在检索整个网站,然后使用正则表达式筛选可能表明登录无效的关键字。cURL只检索URL地址
如果输入了错误的用户名/密码,url本身包含字符串“errormessage”。是否有可能只使用curl来获取url地址,而没有内容加速呢?
这里是我的卷曲的PHP代码:
function curl_get_request($referer, $submit_url, $ch)
{
global $cookie_path;
// sends a request via curl to the string specifics listed
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
curl_setopt($ch, CURLOPT_URL, $submit_url);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_path);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_path);
return $result = curl_exec ($ch);
}
而且,如果有人对如何处理问题这样一个更好的主意,请让我知道!