Analytics reporting from PHP returns null

Hi All,

I am running a piwik setup on a server called (say) xyz.com and I have a reporting script(implemented in php) running at abc.xyz.com (both ubuntu with PHP 5.3). When I try to access the stats from a browser using API (with format set as JSON, XML and PHP) I can see the stats, however when I try doing the same using from PHP file_get_contents($url) I keep getting blank output. Same thing happens when I use php5-curl.

One such url will be this
http://wifreesocial.com/analytics/index.php?module=API&method=VisitsSummary.getVisits&idSite=16&date=last30&period=range&format=PHP&token_auth=9ea7ec0f1484f171531b4620363a297f

Any idea what could be happening ? I do have allow_url_fopen set to On in php,ini and Piwik version is 2.1.

-Kumar

if you are getting blank screen of death, check your server error logs for some info

I am getting xml/json/php output but its always zero when I call the url from script. The same url when accessed from browser does gives me a not zero numeric value.