X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fnetwork.php;h=c6379e407bcc79aae4a3ed852c3409d9225a1f09;hb=df312402e46cc3cdc788c73d0c41874b6c71fcb3;hp=1fd3792753ccb1d6cda23b5235a6c6d86a7ed7a1;hpb=3ada0093f9c09489a765810ebc9b1cc4a2886a33;p=friendica.git diff --git a/include/network.php b/include/network.php index 1fd3792753..c6379e407b 100644 --- a/include/network.php +++ b/include/network.php @@ -42,6 +42,7 @@ if(!function_exists('z_fetch_url')){ * @return array an assoziative array with: * * \e int \b return_code => HTTP return code or 0 if timeout or failure * * \e boolean \b success => boolean true (if HTTP 2xx result) or false + * * \e string \b redirect_url => in case of redirect, content was finally retrieved from this URL * * \e string \b header => HTTP headers * * \e string \b body => fetched content */ @@ -158,13 +159,11 @@ function z_fetch_url($url,$binary = false, &$redirects = 0, $opts=array()) { if (filter_var($newurl, FILTER_VALIDATE_URL)) { $redirects++; @curl_close($ch); - $a->set_curl_redirect_url($newurl); return z_fetch_url($newurl,$binary, $redirects, $opts); } } - $a->set_curl_redirect_url($url); $a->set_curl_code($http_code); $a->set_curl_content_type($curl_info['content_type']); @@ -175,6 +174,7 @@ function z_fetch_url($url,$binary = false, &$redirects = 0, $opts=array()) { $rc = intval($http_code); $ret['return_code'] = $rc; $ret['success'] = (($rc >= 200 && $rc <= 299) ? true : false); + $ret['redirect_url'] = $url; if(! $ret['success']) { $ret['error'] = curl_error($ch); $ret['debug'] = $curl_info;