我正在开发一个PHP脚本来抓取这个网站并将数据通过电子邮件发送给我.这似乎是正确的登录,因为脚本运行时,它似乎重定向并给我一个消息,说对象搬到这里和这里链接到Default.aspx页面,这是到底发生了什么,当我手动登录.
以下是我的脚本:
<?php
$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
// INIT CURL
$ch = curl_init();
//init curl
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'https://access.manager.com/Login.aspx');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
// Set your login and password for authentication
curl_setopt($ch, CURLOPT_USERPWD, 'testu:passwd');
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
// This is occassionally required to stop CURL from verifying the peer's certificate.
// CURLOPT_SSL_VERIFYHOST may also need to be TRUE or FALSE if
// CURLOPT_SSL_VERIFYPEER is disabled …Run Code Online (Sandbox Code Playgroud)