PHP IP address of a visitor

PHP IP address of a visitor

Do you want to display the IP address of a visitor to your webpage? This article will show you the necessary code to do so.

What is the simplest method?


How does the graphic method work?

For example: Your IP Address is

  • Create a new page, copy the text below and save it as image.php (or whatever you wish)
$img_number = imagecreate(275,25);
$backcolor = imagecolorallocate($img_number,102,102,153);
$textcolor = imagecolorallocate($img_number,255,255,255);
$number = " Your IP is $_SERVER[REMOTE_ADDR]";
header("Content-type: image/jpeg");
visit our forum for more ip address related issues