php - Trying to access url that returns json results in connection reset by peer error
My php web app is trying to access another URL on the same site that returns a json payload. My web app is using file_get_contents() on the url that returns the json and then does something with it.
I have tried using curl instead of file_get_contents, but i get the same errors which are:
A PHP Error was encountered Severity: Notice Message: file_get_contents(): send of 24 bytes failed with errno=104 Connection reset by peer Filename: xxxxxx.php Line Number: 46
A PHP Error was encountered Severity: Notice Message: file_get_contents(): send of 2 bytes failed with errno=32 Broken pipe Filename: xxxx.php Line Number: 46
Now, this worked on the previous server the web app was hosted on i'm told and this is now on some shared hosting.
So, to recap, when you visit the url http://example.com/getjson it runs some php that does:
$foo = file_get_contents('http://example.com/twitter.json/?user_id=xxxxxx&count=500&include_rts=1&page=1&include_entities=5');
If i visit http://example.com/twitter.json/?user_id=xxxxxx&count=500&include_rts=1&page=1&include_entities=5 in my browser i see the json, if i try and get it with php, i get the errors above.
I just can't think what to try next!
Any help gratefully received!