Skip to content

Instantly share code, notes, and snippets.

@hsleonis
Last active April 4, 2016 09:50
Show Gist options
  • Select an option

  • Save hsleonis/b26ec19327cde356132e3354fdbd1d8b to your computer and use it in GitHub Desktop.

Select an option

Save hsleonis/b26ec19327cde356132e3354fdbd1d8b to your computer and use it in GitHub Desktop.
CURL is a command line tool for getting or sending files using URL syntax
<?php
// Ref.: http://php.net/manual/en/function.curl-getinfo.php
// http://www.hackingwithphp.com/15/10/2/your-first-curl-scripts
//step1
$cSession = curl_init();
//step2
curl_setopt($cSession,CURLOPT_URL,"http://www.google.com/search?q=curl");
curl_setopt($cSession,CURLOPT_RETURNTRANSFER,true);
curl_setopt($cSession,CURLOPT_HEADER, false);
//step3
$result=curl_exec($cSession);
//step4
curl_close($cSession);
//step5
echo $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment