Advertisement
Guest User

Untitled

a guest
May 13th, 2014
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. $urls = array(
  4.   'pouet.net',
  5.   'www.pouet.net',
  6.   'lemonde.fr',
  7.   'www.lemonde.fr',
  8.   'pastebin.com',
  9.   'www.pastebin.com',
  10.   'curl.haxx.se',
  11.   'www.curl.haxx.se',
  12.   'google.com',
  13.   'www.google.com'
  14. );
  15.  
  16. foreach ($urls as $source) {
  17.   $req = curl_init();
  18.  
  19.   $options = array(
  20.     CURLOPT_FAILONERROR    => true,
  21.     CURLOPT_FOLLOWLOCATION => true,
  22.     CURLOPT_HEADER         => true,
  23.     CURLOPT_NOBODY         => true,
  24.     CURLOPT_RETURNTRANSFER => true,
  25.     CURLOPT_URL            => $source,
  26.   );
  27.  
  28.   curl_setopt_array($req, $options);
  29.  
  30.   if ($res = curl_exec($req)) {
  31.     echo $source . ' → ' . curl_getinfo($req, CURLINFO_EFFECTIVE_URL);
  32.  
  33.     curl_close($req);
  34.   } else {
  35.     echo $source . ' → ' . 'failed';
  36.   }
  37.  
  38.   echo "\n\n";
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement