title: Get content of page using PHP cURL
body: <p>I want to use PHP's cURL to visit a page on an external site, and get some the whole html content of the page.</p>
  
  <p>When i visit the site, it will redirect me to another page on the same site. Also, i have to set the useragent, i want a useragent for PC windows7 chrome and iPhone 4s. This is what i got so far:</p>
  
  <pre><code>$ch = curl_init ($url);
  curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  curl_setopt($ch, CURLOPT_AUTOREFERER , true)
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
  $kl = curl_exec ($ch);
  curl_close($ch);
  echo $kl;
  </code></pre>
  
  <p><b>Notice:</b><br>
  I will probably run into more errors.</p>