I have set up a php program that calls a RESTful web service using curl and gets back well-formed XML. When I do this o开发者_运维技巧n th e command line and I get the correct response but when I do this in PHP using curl_exec()
I only get about half of the response. The response is basically cut short.
Does anyone know the cause of this?
Code is as follows:
$url = $this->dspace_url . '/dspace/search.xml?query=' . urlencode($query);
$sac_curl = curl_init();
error_log('query url is'.$url);
curl_setopt($sac_curl, CURLOPT_HTTPGET, true);
curl_setopt($sac_curl, CURLOPT_URL, $url);
curl_setopt($sac_curl, CURLOPT_VERBOSE, true);
curl_setopt($sac_curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($sac_curl, CURLOPT_HEADER, false);
$resp = curl_exec($sac_curl);
error_log('response is '.$resp);
Thanks, Mark
It looks like you're using the error_log
function to save your response to the error log.
There seems to be a limit on this (defaults to 1024 bytes) but you can change it in your php.ini file using the log_errors_max_len
attribute. Try setting that to something larger and see if you find any difference.
精彩评论