title: Open url with curl, click on ajax button, wait and get response html
body: <p>I am going to scrape <a href="http://www.car4you.at/Haendlersuche" rel="nofollow">http://www.car4you.at/Haendlersuche</a>
  it shows 20 results first time and pagination. I scrape 20 links successfully but facing problem to get link to next page because there is no link in <strong>href</strong> of pagination. It contains a javascript function.</p>
  
  <pre><code>href="javascript:AjaxCallback_ResList('ResultList', 'Pager', '1_1874')"
  </code></pre>
  
  <p>My question is how can I load page with curl then click on next page button, wait for response then parse it.</p>
  
  <p>Here is what I am trying</p>
  
  <p>function of curl</p>
  
  <pre><code>function postCurlReq($loginActionUrl,$parameters,$referer)
  {
          curl_setopt ($this-&gt;curl, CURLOPT_URL,$loginActionUrl); 
          curl_setopt ($this-&gt;curl, CURLOPT_POST, 1); 
          curl_setopt ($this-&gt;curl, CURLOPT_POSTFIELDS, $parameters); 
          curl_setopt ($this-&gt;curl, CURLOPT_COOKIEJAR, realpath('cookie.txt')); // cookie.txt should be in same directoy, where calling script is 
          curl_setopt ($this-&gt;curl, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
          curl_setopt ($this-&gt;curl, CURLOPT_FOLLOWLOCATION, 1);
          curl_setopt ($this-&gt;curl, CURLOPT_RETURNTRANSFER, 1);
          curl_setopt ($this-&gt;curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i586; de; rv:5.0) Gecko/20100101 Firefox/5.0');            
          curl_setopt ($this-&gt;curl, CURLOPT_REFERER, $referer);   // set referer
          curl_setopt ($this-&gt;curl, CURLOPT_SSL_VERIFYPEER, FALSE);// ssl certificate
          curl_setopt ($this-&gt;curl, CURLOPT_SSL_VERIFYHOST, 2);
          $result['EXE'] = curl_exec($this-&gt;curl);
          $result['INF'] = curl_getinfo($this-&gt;curl);
          $result['ERR'] = curl_error($this-&gt;curl);
          return $result;                 
  }
  </code></pre>
  
  <p>and tried code is for pagination</p>
  
  <pre><code>$loginUrl = "http://www.car4you.at/Haendlersuche";
  $parameters = array("href" =&gt; "javascript:AjaxCallback_ResList('ResultList', 'Pager', '1_1874')");
  $referer = "http://www.car4you.at/Haendlersuche";
  
  $loginHTML = $crawler-&gt;postCurlReq($loginUrl,$parameters,$referer);
  
  if ( empty($loginHTML['ERR']) ) { // if no error occure in opening url
  
  print_r($loginHTML['EXE']);
  
  }
  </code></pre>
  
  <p>second method to scrape is select list that show results like
  10
  20
  50
  if my script succeed to select 50 then it ll also be happy work
  and tried code is for select list</p>
  
  <pre><code>$loginUrl = "http://www.car4you.at/Haendlersuche";
  $parameters = array("value" =&gt; "50");
  $referer = "http://www.car4you.at/Haendlersuche";
  
  $loginHTML = $crawler-&gt;postCurlReq($loginUrl,$parameters,$referer);
  
  if ( empty($loginHTML['ERR']) ) { // if no error occure in opening url
  
  print_r($loginHTML['EXE']);
  
  }
  </code></pre>