Advertisement
krot

get_status

Dec 21st, 2016
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.38 KB | None | 0 0
  1. function get_status($url){
  2.  if( $curl = curl_init() ) {
  3.     curl_setopt($curl,CURLOPT_URL,$url);
  4.     curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
  5.     curl_setopt($curl,CURLOPT_NOBODY,true);
  6.     curl_setopt($curl,CURLOPT_HEADER,true);
  7.     $out = curl_exec($curl);
  8.      $status=curl_getinfo($curl,CURLINFO_HTTP_CODE);
  9.      
  10.     curl_close($curl);
  11.      return $status;
  12.   }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement