What's my ISP

Started on the old forum in February 2012 · view the original in the archive · old links redirect here

No replies · 1,888 views · started 14 years ago · 1 min read

kiss Senior · 294 posts #1
 function curl( $url ) {
  if ( in_array( "curl", get_loaded_extensions() ) ) {
   $ch = curl_init() ;
   curl_setopt( $ch, CURLOPT_URL, $url ) ;
   curl_setopt( $ch, CURLOPT_REFERER, $url ) ;
   curl_setopt( $ch, CURLOPT_HEADER, 0 ) ;
   //curl_setopt( $ch, CURLOPT_FRESH_CONNECT, 1 ) ;//optional
   curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ) ;
   curl_setopt( $ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT'] ) ;
   $result = curl_exec( $ch ) ;
   curl_close( $ch ) ;
   return $result ;
  } else {
   $result = file_get_contents( $url ) ;
   return $result ;
  }
 }
----------
function isp( $ip ) {
  $data = curl( "http://whatismyipaddress.com/ip/" . $ip ) ;
  if ( preg_match( "/ISP:<\/th><td>(?P<Isp>.+)<\/td><\/tr><tr><th>Organization:/i", $data, $match ) ) {
   return ucwords( strtolower( str_ireplace( array( "-", "_", "S.a." ), array( " ", " ", "" ), $match["Isp"] ) ) ) ;
  } else {
   return "Unknown" ;
  }
 }
echo isp("127.1.0.0"); // replace with any other ip

www.inbuzunar.mobi -Your mobile portal pocket

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close