Skip to content

Instantly share code, notes, and snippets.

@mayeenulislam
Last active August 29, 2015 14:01
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 mayeenulislam/6827c8445ee202bf1a09 to your computer and use it in GitHub Desktop.
Save mayeenulislam/6827c8445ee202bf1a09 to your computer and use it in GitHub Desktop.
Grabbing a complete website usig cURL
<?php
/* Assisted by Mr. Ariful Haque */
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, 'http://www.oilprice.com');
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($ch);
$dom = new DOMDocument();
$dom->loadHTML( $content );
// Parse the dom for your desired content
print_r($dom);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment