PHP 8.5.0 Alpha 1 available for testing

Voting

: max(one, four)?
(Example: nine)

The Note You're Voting On

Nanuit at ossi dot at
14 years ago
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

<< Back to user notes page

To Top