string strXMLQuery = {corps de la requête XML au format spécifié dans la documentation}
System.Net.WebRequest pWebRequest = null;
string strRequest = System.String.Format ( "http://gpp3-wxs.ign.fr/{0}/geoportail/ols?", m_strCLEF );
pWebRequest = System.Net.WebRequest.Create ( strRequest );
( pWebRequest as System.Net.HttpWebRequest ).Referer = "http://localhost/";
pWebRequest.Credentials = System.Net.CredentialCache.DefaultCredentials;
pWebRequest.Method = "POST";
byte [ ] pByteData = System.Text.Encoding.UTF8.GetBytes ( strXMLQuery );
pWebRequest.ContentType = "text/xml; charset=\"utf-8\"";
pWebRequest.ContentLength = pByteData.Length;
using ( System.IO.Stream pRequestStream = pWebRequest.GetRequestStream ( ) )
{
pRequestStream.Write ( pByteData, 0, pByteData.Length );
}
string strXMLText = "";
using ( System.Net.WebResponse pWebResponse = pWebRequest.GetResponse ( ) ) //Ici exception retour 403
{
}
Partager