For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Thursday, October 10, 2013

JSON in PHP Simple

Simple JSON in PHP

test.php
<script type="application/javascript">
function getip(json){
    alert(json);
}
</script>
<script type="application/javascript" src="http://localhost:90/test/a1.php?callback=getip"></script>


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

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

0 comments:

Post a Comment

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights   You have a website and want to test it'...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive