je me suis mis à AutoIt il y a très peu, donc soyez indulgents ^^
J'ai récupéré ce code sur internet :
Code : Tout sélectionner
;HttpRequest.au3
#include-once
Global Const $HTTP_STATUS_OK = 200
Func HttpPost($sURL, $sData = "")
Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Open("POST", $sURL, False)
If (@error) Then Return SetError(1, 0, 0)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.Send($sData)
If (@error) Then Return SetError(2, 0, 0)
If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0)
Return SetError(0, 0, $oHTTP.ResponseText)
EndFunc
Func HttpGet($sURL, $sData = "")
Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Open("GET", $sURL & "?" & $sData, False)
If (@error) Then Return SetError(1, 0, 0)
$oHTTP.Send()
If (@error) Then Return SetError(2, 0, 0)
If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0)
Return SetError(0, 0, $oHTTP.ResponseText)
EndFunc
Puis mon module à moi :
Code : Tout sélectionner
#include "HttpRequest.au3"
#include <Excel.au3>
Global $data = HttpPost("https://www.pfiffiggas.de/calculator/web/service/price/", "postcode=54331&container=1")
[...]
Code : Tout sélectionner
{"id":"15061", "price":2787}
Code : Tout sélectionner
0
Merci
