Online Code Generator

PHP and Javascript Code Snippets for Common Uses

What is my IP Address?

Your IP Address is:

54.157.81.13

PHP:

Read more on the $_SERVER variable.

$ip_address = $_SERVER['REMOTE_ADDR'];

JavaScript:

You need to call a server-side script to accomplish this. First create a PHP file on your server and paste this in it:

<?php
header('content-type: application/json; charset=utf-8');

$data = json_encode($_SERVER['REMOTE_ADDR']);
echo $_GET['callback'] . '(' . $data . ');';

Next, use this JavaScript to call the PHP file you created above.

<script type="application/javascript">
function getip(json){
    alert(json); // alerts the ip address
}
</script>
<script type="application/javascript" src="http://www.anotherdomain.com/file.php?callback=getip" ></script>
mobil porno porno izle sex izle