1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| $CLEF='CLE';
// $REFERER='localhost';
$REFERER='SITE';
var_dump('test1');
$sUrl="http://gpp3-wxs.ign.fr/".$CLEF."/geoportail/ols";
$aUrl= @parse_url($sUrl);
$sHeader = "Host: ".$aUrl['host']."\r\n"
. "Referer: ".$REFERER."\r\n";
$data = '<?xml version="1.0" encoding="UTF-8"?>
<XLS
xmlns:xls="http://www.opengis.net/xls"
xmlns:gml="http://www.opengis.net/gml"
xmlns="http://www.opengis.net/xls"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.2"
xsi:schemaLocation="http://www.opengis.net/xls http://schemas.opengis.net/ols/1.2/olsAll.xsd">
<RequestHeader/>
<Request requestID="1" version="1.2" methodName="LocationUtilityService">
<GeocodeRequest returnFreeForm="false">
<Address countryCode="StreetAddress">
<freeFormAddress>'.$adresse.'</freeFormAddress>
</Address>
</GeocodeRequest>
</Request>
</XLS>';
$sReq= "POST $sUrl HTTP/1.0\r\n"
. $sHeader
. "Content-Type: text/xml\r\n"
. "Content-length: ".strlen($data)."\r\n"
. "\r\n"
. $data
;
$sReq.= "\r\n";
// envoi de la requête
$host= $aUrl["host"];
$port = '80';
$fp= @fsockopen($host, $port, $errno, $errstr, 5);
if (!$fp) {
//On fait face au proxy
$fp= @fsockopen(PROXY','8080', $errno, $errstr, 5);
}
fwrite($fp, $sReq);
// attente de la réponse
$headers= '';
$sReponse= '';
// ob_start();
while (!feof($fp)) {
$sReponse.= fread($fp, 4096);
}
fclose ($fp); |
Partager