note 102309 modified in function.simplexml-load-file by danbrown
| From: | danbrown@php.net | Date: | Tue, 08 Feb 2011 12:27:40 +0000 |
| Subject: | note 102309 modified in function.simplexml-load-file by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-176764@lists.php.net to get a copy of this message | ||
A little function very helpfull in using simplexml_load_file behind a proxy
<?php
function getXMLfromURL($url) {
$Proxy = getenv("HTTP_PROXY");
if (strlen($Proxy) > 1) {
$r_default_context = stream_context_get_default ( array
('http' => array(
'proxy' => $Proxy,
'request_fulluri' => True,
),
)
);
libxml_set_streams_context($r_default_context);
}
$daten = simplexml_load_file($url);
return ($daten);
}
?>
where HTTP_PROXY is set to e.g.: tcp://proxy:8080
--was--
A little function very helpfull in using simplexml_load_file behind a proxy
function getXMLfromURL($url) {
$Proxy = getenv("HTTP_PROXY");
if (strlen($Proxy) > 1) {
$r_default_context = stream_context_get_default ( array
('http' => array(
'proxy' => $Proxy,
'request_fulluri' => True,
),
)
);
libxml_set_streams_context($r_default_context);
}
$daten = simplexml_load_file($url);
return ($daten);
}
where HTTP_PROXY is set to e.g.: tcp://proxy:8080
http://php.net/manual/en/function.simplexml-load-file.php