X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fnetwork.php;h=78ed24074367e24d4fada4dc14103f55667f657f;hb=cb05e677a96e1312263c0a1c63ee10cea62268b1;hp=a9ee3f0a54deece8d4624e337c8569a758a0a448;hpb=00c342e13d833fd215e5dc03a508e1abe660fe21;p=friendica.git diff --git a/include/network.php b/include/network.php index a9ee3f0a54..78ed240743 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,8 +14,16 @@ 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"); + @curl_setopt($ch, CURLOPT_USERAGENT, "Friendica"); + if(intval($timeout)) { @curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); @@ -97,7 +105,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0) curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$params); - curl_setopt($ch, CURLOPT_USERAGENT, "Friendika"); + curl_setopt($ch, CURLOPT_USERAGENT, "Friendica"); if(intval($timeout)) { curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);