Merge pull request #659 from mexon/fetch_url_content_type

Make the content type available after calling fetch_url
This commit is contained in:
tobiasd 2013-04-02 00:17:28 -07:00
commit dbc4371391
2 changed files with 10 additions and 0 deletions

View File

@ -401,6 +401,7 @@ if(! class_exists('App')) {
private $db; private $db;
private $curl_code; private $curl_code;
private $curl_content_type;
private $curl_headers; private $curl_headers;
private $cached_profile_image; private $cached_profile_image;
@ -673,6 +674,14 @@ if(! class_exists('App')) {
return $this->curl_code; return $this->curl_code;
} }
function set_curl_content_type($content_type) {
$this->curl_content_type = $content_type;
}
function get_curl_content_type() {
return $this->curl_content_type;
}
function set_curl_headers($headers) { function set_curl_headers($headers) {
$this->curl_headers = $headers; $this->curl_headers = $headers;
} }

View File

@ -101,6 +101,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
} }
$a->set_curl_code($http_code); $a->set_curl_code($http_code);
$a->set_curl_content_type($curl_info['content_type']);
$body = substr($s,strlen($header)); $body = substr($s,strlen($header));
$a->set_curl_headers($header); $a->set_curl_headers($header);