107 curl_setopt($fp, CURLOPT_TIMEOUT, $timeout); |
107 curl_setopt($fp, CURLOPT_TIMEOUT, $timeout); |
108 curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout); |
108 curl_setopt($fp, CURLOPT_CONNECTTIMEOUT, $timeout); |
109 curl_setopt($fp, CURLOPT_REFERER, $url); |
109 curl_setopt($fp, CURLOPT_REFERER, $url); |
110 curl_setopt($fp, CURLOPT_USERAGENT, $useragent); |
110 curl_setopt($fp, CURLOPT_USERAGENT, $useragent); |
111 curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2); |
111 curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2); |
112 if (!ini_get('open_basedir') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>=')) |
|
113 { |
|
114 curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1); |
|
115 curl_setopt($fp, CURLOPT_MAXREDIRS, $redirects); |
|
116 } |
|
117 foreach ($curl_options as $curl_param => $curl_value) { |
112 foreach ($curl_options as $curl_param => $curl_value) { |
118 curl_setopt($fp, $curl_param, $curl_value); |
113 curl_setopt($fp, $curl_param, $curl_value); |
119 } |
114 } |
120 |
115 |
121 $this->headers = curl_exec($fp); |
116 $this->headers = curl_exec($fp); |
146 if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) |
141 if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) |
147 { |
142 { |
148 $this->redirects++; |
143 $this->redirects++; |
149 $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); |
144 $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); |
150 $previousStatusCode = $this->status_code; |
145 $previousStatusCode = $this->status_code; |
151 $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); |
146 $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen, $curl_options); |
152 $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; |
147 $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; |
153 return; |
148 return; |
154 } |
149 } |
155 } |
150 } |
156 } |
151 } |
231 if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) |
226 if ((in_array($this->status_code, array(300, 301, 302, 303, 307)) || $this->status_code > 307 && $this->status_code < 400) && isset($this->headers['location']) && $this->redirects < $redirects) |
232 { |
227 { |
233 $this->redirects++; |
228 $this->redirects++; |
234 $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); |
229 $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); |
235 $previousStatusCode = $this->status_code; |
230 $previousStatusCode = $this->status_code; |
236 $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); |
231 $this->__construct($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen, $curl_options); |
237 $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; |
232 $this->permanent_url = ($previousStatusCode == 301) ? $location : $url; |
238 return; |
233 return; |
239 } |
234 } |
240 if (isset($this->headers['content-encoding'])) |
235 if (isset($this->headers['content-encoding'])) |
241 { |
236 { |