Skip to content

Instantly share code, notes, and snippets.

@mach3
Created December 16, 2010 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mach3/743180 to your computer and use it in GitHub Desktop.
Save mach3/743180 to your computer and use it in GitHub Desktop.
The cheapest example of curl for file_get_contents
<?php
function curl_get_contents( $url ){
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url );
curl_setopt( $ch, CURLOPT_HTTPHEADER, false );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$result = curl_exec( $ch );
curl_close( $ch );
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment