eugene2009 Posted April 3, 2010 Share Posted April 3, 2010 How would I go about using an “img src” tag to call a PHP script that looks like a .gif, but instead of showing a graphic that program looks at the server environment in order to capture the IP address. please help. thank you Link to comment https://forums.phpfreaks.com/topic/197447-capturing-ip-address/ Share on other sites More sharing options...
slurpee Posted April 3, 2010 Share Posted April 3, 2010 Why can't you use $_SERVER[REMOTE_ADDR]? Link to comment https://forums.phpfreaks.com/topic/197447-capturing-ip-address/#findComment-1036332 Share on other sites More sharing options...
eugene2009 Posted April 3, 2010 Author Share Posted April 3, 2010 because say i want to put this on a myspace profile.. i cannot run scripts on myspace.. lol Link to comment https://forums.phpfreaks.com/topic/197447-capturing-ip-address/#findComment-1036333 Share on other sites More sharing options...
ignace Posted April 3, 2010 Share Posted April 3, 2010 <img src="http://my-cool-server.com/my-cool-page.php" width=".." height=".."> header('Content-Type: image/<image-mime>'); //your processing here.. //be sure to return an image at the end. Link to comment https://forums.phpfreaks.com/topic/197447-capturing-ip-address/#findComment-1036337 Share on other sites More sharing options...
eugene2009 Posted April 3, 2010 Author Share Posted April 3, 2010 is this the proper way to do it? <? header('Content-Type: image/<image-mime>'); echo '<img src="img_url_here">'; ?> because it is not working Link to comment https://forums.phpfreaks.com/topic/197447-capturing-ip-address/#findComment-1036341 Share on other sites More sharing options...
ignace Posted April 3, 2010 Share Posted April 3, 2010 No something along the lines of: header('Content-Type: ' . image_type_to_mime_type(IMAGETYPE_GIF)); $image = imagecreatetruecolor(180, 30); imagestring($image, 3, 5, 5, $_SERVER['REMOTE_ADDR'], imagecolorallocate($image, 255, 255, 255)); imagegif($image); Link to comment https://forums.phpfreaks.com/topic/197447-capturing-ip-address/#findComment-1036347 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.