与festivalnet的网络抓取问题


webscraping issue with festivalnet

我正在尝试从festivalnet中废弃事件列表数据。只有登录后才能检索到。我使用Curl在PHP中进行了尝试。但无法登录festivalnet页面,我正在发布带有curl的参数。

//username and password of account
$login_username = 'abcd';
$password = 'xxxx';

//login form action url
$form_url="https://festivalnet.com/cgi-bin/festbiz2/db.cgi"; 

$postinfo = "userid=".$login_username."&pw=".$password.'&db=festbiz&login=1';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $form_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo);    
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
echo curl_exec($ch);

它重定向到https://festivalnet.com/cgi-bin/festbiz2/db.cgi?db=festbiz&login=3&return_to=%2Fno%2Findex.php%3Fmode%3Dcp

请帮忙。

尝试CURLOPT_COOKIEFILE和CURLOPT_COOKIEJAR。

用法如下所示