Advertisement
Guest User

Untitled

a guest
Oct 26th, 2012
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1.     public function getAddress( $url )
  2.     {
  3.         if( function_exists( 'curl_init' ) )
  4.         {
  5.             $cURL = curl_init( $url );
  6.             if(curl_setopt( $cURL, CURLOPT_RETURNTRANSFER, true ))
  7.             {
  8.                 curl_setopt( $cURL, CURLOPT_FOLLOWLOCATION, true );
  9.                 $address = curl_exec( $cURL );
  10.                 curl_close( $cURL );
  11.             }
  12.             else
  13.             {
  14.                 $address = @file_get_contents( $url );
  15.             }
  16.         }
  17.         else
  18.         {
  19.             $address = file_get_contents( $url );
  20.         }
  21.         if( !$address )
  22.         {
  23.             return false;
  24.         }
  25.         else
  26.         {
  27.             return trim($address);
  28.         }
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement