network: Small changes

This commit is contained in:
Michael Vogel 2012-07-07 20:40:15 +02:00
parent dafc84390d
commit e9d7f85297

View file

@ -22,7 +22,8 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
} }
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
@curl_setopt($ch, CURLOPT_USERAGENT, "Friendica"); //@curl_setopt($ch, CURLOPT_USERAGENT, "Friendica");
@curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Friendica)");
if(intval($timeout)) { if(intval($timeout)) {
@ -59,7 +60,6 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
$base = $s; $base = $s;
$curl_info = @curl_getinfo($ch); $curl_info = @curl_getinfo($ch);
$http_code = $curl_info['http_code']; $http_code = $curl_info['http_code'];
// logger('fetch_url:' . $http_code . ' data: ' . $s); // logger('fetch_url:' . $http_code . ' data: ' . $s);
$header = ''; $header = '';
@ -88,9 +88,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
$a->set_curl_code($http_code); $a->set_curl_code($http_code);
$body = substr($s,strlen($header)); $body = substr($s,strlen($header));
$a->set_curl_headers($header); $a->set_curl_headers($header);
@curl_close($ch); @curl_close($ch);
return($body); return($body);
}} }}