downloadHttp() public méthode

If an HTTP proxy has been configured (http_proxy PEAR_Config setting), the proxy will be used.
public downloadHttp ( string $url, false | string | array $lastmodified = null, false | array $accept = false, $channel = false ) : string | array
$url string the URL to download
$lastmodified false | string | array header values to check against for caching use false to return the header values from this download
$accept false | array Accept headers to send
Résultat string | array Returns the contents of the downloaded file or a PEAR error on failure. If the error is caused by socket-related errors, the error object will have the fsockopen error code available through getCode(). If caching is requested, then return the header values.
Exemple #1
0
 function _checkChannelForStatus($channel, $chan)
 {
     $rest = new PEAR_REST($this->config);
     PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
     $a = $rest->downloadHttp('http://' . $channel . '/channel.xml', $chan->lastModified());
     PEAR::staticPopErrorHandling();
     if (!PEAR::isError($a) && $a) {
         $this->ui->outputData('WARNING: channel "' . $channel . '" has ' . 'updated its protocols, use "channel-update ' . $channel . '" to update');
     }
 }
 function _checkChannelForStatus($channel, $chan)
 {
     if (PEAR::isError($chan)) {
         $this->raiseError($chan);
     }
     if (!is_a($chan, 'PEAR_ChannelFile')) {
         return $this->raiseError('Internal corruption error: invalid channel "' . $channel . '"');
     }
     $rest = new PEAR_REST($this->config);
     PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
     $a = $rest->downloadHttp('http://' . $channel . '/channel.xml', $chan->lastModified());
     PEAR::staticPopErrorHandling();
     if (!PEAR::isError($a) && $a) {
         $this->ui->outputData('WARNING: channel "' . $channel . '" has ' . 'updated its protocols, use "channel-update ' . $channel . '" to update');
     }
 }
 /**
  * @see PEAR_REST::downloadHttp()
  */
 public function downloadHttp($url, $lastmodified = null, $accept = false)
 {
     return parent::downloadHttp($url, $lastmodified, array_merge(false !== $accept ? $accept : array(), array("\r\nX-SYMFONY-VERSION: " . SYMFONY_VERSION)));
 }
 /**
  * @see PEAR_REST::downloadHttp()
  */
 public function downloadHttp($url, $lastmodified = null, $accept = false)
 {
     return parent::downloadHttp($url, $lastmodified, $accept);
 }