Option Explicit
Sub test1()
' POST metodu
Dim http As Object, trh As String, url As String, txt As String, istek As String
istek = _
"<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
" <soap:Body>" & _
" <LpgPiyasasiEnYuksekHacimliSekizFirmaninOrtalamaLpgFiyatlari xmlns=""http://dbs.epdk.org.tr/EPDKLpgWS/"">" & _
" <Tarih>@tarih@</Tarih>" & _
" </LpgPiyasasiEnYuksekHacimliSekizFirmaninOrtalamaLpgFiyatlari>" & _
" </soap:Body>" & _
"</soap:Envelope>"
Set http = CreateObject("msxml2.xmlhttp")
trh = "2014-07-09" ' yyyy-mm-dd
url = "http://dbs.epdk.org.tr/EPDKLpgWS/EPDKLpg.asmx?op=LpgPiyasasiEnYuksekHacimliSekizFirmaninOrtalamaLpgFiyatlari"
http.Open "post", url, False
http.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
http.send Replace(istek, "@tarih@", trh)
txt = http.responsetext
Debug.Print txt
http.abort
Set http = Nothing
End Sub
Sub test2()
' GET metodu (test1 in "get" metodu. Ayrıca dönen xml girintili olarak gelir.)
Dim http As Object, trh As String, url As String, txt As String
Set http = CreateObject("msxml2.xmlhttp")
trh = "2014/07/09" ' yyyy/mm/dd
url = "http://dbs.epdk.org.tr/EPDKLpgWS/EPDKLpg.asmx" & _
"/LpgPiyasasiEnYuksekHacimliSekizFirmaninOrtalamaLpgFiyatlari?Tarih=" & trh
http.Open "get", url, False
http.send
txt = http.responsetext
Debug.Print txt
http.abort
Set http = Nothing
End Sub
Sub test3()
' POST metodu
Dim http As Object, trh As String, url As String, txt As String
Dim plk As String, m As Variant, istek As String
istek = _
"<?xml version=""1.0"" encoding=""utf-8""?>" & _
"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
" <soap:Body>" & _
" <LpgPiyasasiIllereGoreLpgFiyatlari xmlns=""http://dbs.epdk.org.tr/EPDKLpgWS/"">" & _
" <GecerliTarih>@tarih@</GecerliTarih>" & _
" <TrafikKodu>@plaka@</TrafikKodu>" & _
" </LpgPiyasasiIllereGoreLpgFiyatlari>" & _
" </soap:Body>" & _
"</soap:Envelope>"
Set http = CreateObject("msxml2.xmlhttp")
trh = "2014-07-09" ' yyyy-mm-dd
plk = "54" ' Sakarya
url = "http://dbs.epdk.org.tr/EPDKLpgWS/EPDKLpg.asmx?op=LpgPiyasasiIllereGoreLpgFiyatlari"
http.Open "post", url, False
http.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
m = Replace(istek, "@tarih@", trh)
m = Replace(m, "@plaka@", plk)
http.send m
txt = http.responsetext
Debug.Print txt
http.abort
Set http = Nothing
End Sub
Sub test4()
' GET metodu (test3 ün "get" metodu. Ayrıca dönen xml girintili olarak gelir.)
Dim http As Object, trh As String, url As String, txt As String, plk As String
Set http = CreateObject("msxml2.xmlhttp")
trh = "2014/07/09" ' yyyy/mm/dd
plk = 54 ' Sakarya
url = "http://dbs.epdk.org.tr/EPDKLpgWS/EPDKLpg.asmx/" & _
"LpgPiyasasiIllereGoreLpgFiyatlari?GecerliTarih=" & trh & "&TrafikKodu=" & plk
http.Open "get", url, False
http.send
txt = http.responsetext
Debug.Print txt
http.abort
Set http = Nothing
End Sub