I'm sending an http GET request and retrieving the response with file_get_contents, and since it's having to be routed through a proxy, I'm using a stream context.
Now, the url is 88 characters, plus a url-encoded xml document thats being passed in the query string. The xml doc in question is approximately 2500 characters long after url-encoding. Before I get deluged by advice to use POST, I should say that it's out of my hands...The remote resource only accepts GETs and is managed by an entirely different team.
The first time I send this GET request, I get a warning from php and a zero-length response, but if I request it again within a short time (a couple of minutes), it works fine...The warning I'm getting says "file_get_contents(http://example.com/?content=blahblahblah on line 52", where "blahblahblah" is the xml, but its truncated significantly. This almost seems like an incomplete error message.
The remote server is properly configured to handle GETs this long (so I am told by the server admins), so is it possible that PHP is truncating the request the first time, for some reason? If so, how would I prevent it from doing so?
And if it's not PHP, is there anything else it could be, other than the remote resource kludging up for some reason?
If it helps, this is the exact method I'm using to call file_get_contents:
$context = stream_context_create(
array(
'http' => array(
'proxy' => 'tcp://192.168.2.1:80',
'request_fulluri' => TRUE,
)
)
);
$response = file_get_contents($url, false, $context);