我要做的是登录一个网站,然后从表中获取数据,因为它们没有导出功能。到目前为止,我已经成功登录,它向我显示了用户主页。但是,我需要导航到不同的页面或以某种方式抓取该页面,同时仍使用 curl 登录。
到目前为止我的代码:
$username="email";
$password="password";
$url="https://jiltapp.com/sessions";
$cookie="cookie.txt";
$url2 = "https://jiltapp.com/shops/shopname/orders";
$postdata = "email=".$username."&password=".$password;
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt ($ch, CURLOPT_REFERER, $url);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
curl_setopt ($ch, CURLOPT_POST, 1);
$result = curl_exec ($ch);
echo $result;
curl_close($ch);
正如我提到的,我可以访问主用户页面,但我需要获取 $url2 变量的内容,而不是 $url。我怎样才能完成这样的事情?
谢谢!