Skip to content

Instantly share code, notes, and snippets.

@sagive
Created January 20, 2015 02:09
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 sagive/5b6d3e97ad92102a67ed to your computer and use it in GitHub Desktop.
Save sagive/5b6d3e97ad92102a67ed to your computer and use it in GitHub Desktop.
Example - mixing it toghter
include('../functions/browser-agent.php');
include('../functions/strings.php');
include('../functions/curl-helper.php');
// ADD BROWSER EMULATION TO FILE GET CONTENT
$useragent = get_random_useragent();
// SCRAPE THE DESIRED PAGE
$clnUrl2Chk = normalize_url($urltocheck);
$html = curl_download($urltocheck, $clnUrl2Chk, $useragent);
$dom = new DOMDocument;
@$dom->loadHTML($html);
$links = $dom->getElementsByTagName('a');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment