在musicmagpie上使用curl、php和simple_html_dom创建购物车进程

在musicmagpie上使用curl、php和simple_html_dom创建购物车进程,php,curl,screen-scraping,Php,Curl,Screen Scraping,我已经写了一个脚本,可以与我们的网站购物车系统一起使用,但事实证明音乐喜鹊很难。它似乎没有为我举行会议以获得结果 我猜他们试图阻止这一切的发生,但就我所知,我做得对。有什么建议吗 我的代码是: require('simple_html_dom.php'); function grab_via_proxy_combination($url,$fields) { foreach($fields as $key=>$value) { $fields_string .= $key.'='.$

我已经写了一个脚本,可以与我们的网站购物车系统一起使用,但事实证明音乐喜鹊很难。它似乎没有为我举行会议以获得结果

我猜他们试图阻止这一切的发生,但就我所知,我做得对。有什么建议吗

我的代码是:

require('simple_html_dom.php');

function grab_via_proxy_combination($url,$fields)
{


foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');


curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_TIMEOUT,2400);
curl_setopt($ch,CURLOPT_TIMEOUT_MS,2400);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0 FirePHP/0.6');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,2400);
//curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
$cookie_file = "cookies/magpie.txt";
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, $header);
if ($fields) {curl_setopt($ch,CURLOPT_POST, count($fields)); } 
if ($fields) {curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); }


    $curl_scraped_page = curl_exec($ch);

    $html = new simple_html_dom();
    $res = $html->load($curl_scraped_page, true, false);


    if (strlen($res) > 100) {
    return $res;
    }
    else {


    }

}


$fields = array(
                        'barcode' => urlencode('711719274551')
                );



$html = grab_via_proxy_combination('http://www.musicmagpie.co.uk/Sellit.asp?result=nq&barcode=0711719274551&loc=103',$fields);

echo $html;

我的猜测是CURLOPT_COOKIESESSION是罪魁祸首。如何废弃ajax加载的数据?