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
| $request_url = 'https://wxs.ign.fr/essentiels/geoportail/ols?';
$request_params = '<?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 maximumResponses="10" methodName="LocationUtilityService" requestID="1" version="1.2">
<GeocodeRequest returnFreeForm="false">
<Address countryCode="StreetAddress">
<freeFormAddress>Grenoble</freeFormAddress>
<gml:envelope>
...
</gml:envelope>
</Address>
</GeocodeRequest>
</Request>
</XLS>';
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $request_url);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
curl_setopt( $ch, CURLOPT_POST, 1 );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $request_params );
$response = curl_exec( $ch );
if(curl_errno($ch)){
echo 'Request Error:' . curl_error($ch);
} |
Partager