Skip to content
Snippets Groups Projects
Commit 0803084c authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

NEW The getURLContent return more information on success and error

parent cd965497
No related branches found
No related tags found
No related merge requests found
...@@ -117,18 +117,16 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea ...@@ -117,18 +117,16 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
//getting response from server //getting response from server
$response = curl_exec($ch); $response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request $request = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request
dol_syslog("getURLContent request=".$status);
dol_syslog("getURLContent response=".$response); dol_syslog("getURLContent request=".$request);
dol_syslog("getURLContent httpresponse=".$httpreponse." response=".$response);
$rep=array(); $rep=array();
$rep['content']=$response;
$rep['curl_error_no']='';
$rep['curl_error_msg']='';
if (curl_errno($ch)) if (curl_errno($ch))
{ {
$rep['content']=$response;
// moving to display page to display curl errors // moving to display page to display curl errors
$rep['curl_error_no']=curl_errno($ch); $rep['curl_error_no']=curl_errno($ch);
$rep['curl_error_msg']=curl_error($ch); $rep['curl_error_msg']=curl_error($ch);
...@@ -138,7 +136,14 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea ...@@ -138,7 +136,14 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
else else
{ {
$info = curl_getinfo($ch); $info = curl_getinfo($ch);
$rep['header_size']=$info['header_size'];
$rep = $info;
//$rep['header_size']=$info['header_size'];
//$rep['http_code']=$info['http_code'];
// Add more keys
$rep['curl_error_no']='';
$rep['curl_error_msg']='';
//closing the curl //closing the curl
curl_close($ch); curl_close($ch);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment