PDA

View Full Version : Show ISP?



Xiwl
03-07-2008, 01:00 PM
How can you show the viewers ISP in php?

Thanks.

PreProcessor
03-07-2008, 01:23 PM
Do you mean something like this? Or do you mean like actually show the name e.g: Virgin Media ?

<?php

$ip = $_SERVER['REMOTE_ADDR'];
$isp = @getHostByAddr( $ip );

print $isp

?>

?

I will try again to post, everytime I try a message comes up for like 1 second then disappears.. :S.

Do you want something like this or, the actual ISP's name like Virgin Media?



<?php

$ip = $_SERVER['REMOTE_ADDR'];
$isp = @getHostByAddr( $ip );

print $isp

?>


That prints out some address that has the ISP in it..?

I think I can post now lol.

Anyway is it like this you want? Or the actual ISP name?



<?php

$ip = $_SERVER['REMOTE_ADDR'];
$isp = @getHostByAddr( $ip );

print $isp

?>


This is about the 5th time I've tried to post this :\ keep getting a error message about a MOD needs to approve it.

Edited By DaveTaylor// (Forum Moderator) Posts approved and merged.

Robbie
03-07-2008, 02:34 PM
<?php
$ip = "" . $_SERVER['REMOTE_ADDR'] . "";
$isptc = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$ispoh = preg_split("/./", $isptc);
$xy = count($ispoh);
$x = $xy - 1;
$y = $xy - 2;
$i = $xy - 3;
$ispp = "" . $ispoh[$i] . ".";
$isp = "" . $ispoh[$y] . "." . $ispoh[$x] . "";
echo"<b>ip: $ip</b><br>";
echo"<b>isp: $ispp$isp</b>";
?>

try that

Flisker
04-07-2008, 05:45 PM
<?php
$ip = "" . $_SERVER['REMOTE_ADDR'] . "";
$isptc = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$ispoh = preg_split("/./", $isptc);
$xy = count($ispoh);
$x = $xy - 1;
$y = $xy - 2;
$i = $xy - 3;
$ispp = "" . $ispoh[$i] . ".";
$isp = "" . $ispoh[$y] . "." . $ispoh[$x] . "";
echo"<b>ip: $ip</b><br>";
echo"<b>isp: $ispp$isp</b>";
?>try that
Your one just posts this:

ip: XX.XX.XX.XX
isp: ..

ISP just has .. in it because my ISP Host name is Bethere.co.uk

Independent
04-07-2008, 08:23 PM
Your one just posts this:

ip: XX.XX.XX.XX
isp: ..

ISP just has .. in it because my ISP Host name is Bethere.co.uk
Be There FTW, well o2. ;)

Want to hide these adverts? Register an account for free!