aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-11-17 13:40:11 +0100
committerFabio Comuni <fabrix.xm@gmail.com>2011-11-17 13:40:11 +0100
commit02281be0c3b19bcab3ae3a96475846104af11e92 (patch)
tree167c2697fc1a6749786fe1ab252b9fdab827e90a /include/network.php
parentd77c87f42ae1e6906de4a087e752a7babef11421 (diff)
downloadvolse-hubzilla-02281be0c3b19bcab3ae3a96475846104af11e92.tar.gz
volse-hubzilla-02281be0c3b19bcab3ae3a96475846104af11e92.tar.bz2
volse-hubzilla-02281be0c3b19bcab3ae3a96475846104af11e92.zip
oembed: don't try to fetch media files and add Accept request header to fetch_url
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/network.php b/include/network.php
index a9ee3f0a5..e89eb94da 100644
--- a/include/network.php
+++ b/include/network.php
@@ -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);
}