Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">;
- <html xmlns="http://www.w3.org/1999/xhtml">;
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>mencari link dari hasil google search dan menyimpan ke file</title>
- </head>
- <body>
- <form method="post" action="">
- <input name="wewewe" >
- <div id="submit">
- <input type="submit" />
- </div>
- </form>
- <?php
- $myfile = fopen("carizombieidup.csv", "a+") or die("Unable to open file!");
- $url = $_POST['wewewe'];
- $curl = curl_init($url);
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
- $output = curl_exec($curl);
- curl_close($curl);
- $DOM = new DOMDocument;
- $DOM->loadHTML( $output);
- //get all H1
- $items = $DOM->getElementsByTagName('h1');
- //display all H1 text
- $hasil = "";
- for ($i = 0; $i < $items->length; $i++){
- $hasil .= $items->item($i)->nodeValue ;
- }
- fwrite ($myfile, $url .", ". $hasil ."\r\n");
- fclose($myfile);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement