oembed: don't try to fetch media files and add Accept request header to fetch_url
This commit is contained in:
parent
d77c87f42a
commit
02281be0c3
2 changed files with 29 additions and 15 deletions
|
|
@ -5,7 +5,7 @@
|
|||
// results.
|
||||
|
||||
if(! function_exists('fetch_url')) {
|
||||
function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0) {
|
||||
function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_content=Null) {
|
||||
|
||||
$a = get_app();
|
||||
|
||||
|
|
@ -14,9 +14,17 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0) {
|
|||
return false;
|
||||
|
||||
@curl_setopt($ch, CURLOPT_HEADER, true);
|
||||
|
||||
if (!is_null($accept_content)){
|
||||
curl_setopt($ch,CURLOPT_HTTPHEADER, array (
|
||||
"Accept: "+$accept_content
|
||||
));
|
||||
}
|
||||
|
||||
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
||||
@curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
|
||||
|
||||
|
||||
if(intval($timeout)) {
|
||||
@curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue