Advertisement
Guest User

Links

a guest
Aug 29th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <?php
  2.  
  3. $curl = curl_init();
  4.  
  5. curl_setopt($curl, CURLOPT_URL, "http://foro.elhacker.net");
  6. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  7.  
  8. $response = curl_exec($curl);
  9.  
  10. $document = new DOMDocument();
  11. @$document->loadHTML($response);
  12.  
  13. $links = $document->getElementsByTagName("a");
  14. $href = array();
  15. foreach($links as $link){
  16.     $node = $link->attributes->getNamedItem("href");
  17.     if($node != NULL){
  18.         $href[] = $node->nodeValue;
  19.     }
  20. }
  21.  
  22. print_r($href);
  23.  
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement