Get contents of a remotely hosted file using PHP

#Note to self –

Usually I accomplish this on the client side by using jsonp calls. However, to get contents of a remotely hosted file on server side, use PHP file_get_contents()

$file = file_get_contents(‘http://qa.agrinova.intuit.com/webmetrics/farmerCount.groovy’);
echo $file;

Output :

<?xml version=”1.0″?>
<webmetrics xmlns=’http://agrinova.intuit.com’&gt;
<farmer_count>290158</farmer_count>
<statewise_count state=’GJ’ count=’135070′ />
<statewise_count state=’AP’ count=’155088′ />
</webmetrics>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: