daily pastebin goal
18%
SHARE
TWEET

curl

a guest Nov 25th, 2016 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">;
  2. <html xmlns="http://www.w3.org/1999/xhtml">;
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>mencari link dari hasil google search dan menyimpan ke file</title>
  6. </head>
  7. <body>
  8. <form method="post" action="">
  9. <input name="wewewe" >
  10. <div id="submit">
  11. <input type="submit" />
  12. </div>
  13. </form>
  14. <?php
  15. $myfile = fopen("carizombieidup.csv", "a+") or die("Unable to open file!");
  16.  $url  = $_POST['wewewe'];
  17. $curl = curl_init($url);
  18. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
  19. curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
  20. $output = curl_exec($curl);
  21. curl_close($curl);
  22. $DOM = new DOMDocument;
  23. $DOM->loadHTML( $output);
  24.  
  25. //get all H1
  26. $items = $DOM->getElementsByTagName('h1');
  27.  
  28. //display all H1 text
  29. $hasil = "";
  30. for ($i = 0; $i < $items->length; $i++){
  31.     $hasil .= $items->item($i)->nodeValue ;
  32. }
  33. fwrite ($myfile, $url .", ".  $hasil ."\r\n");
  34. fclose($myfile);
  35. ?>
  36. </body>
  37. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top