Monthly Archives: August 2011

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&#8217;); 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