Hallo
ich bin neu
hier im Forum und meine VBS Kenntnisse sind noch nicht sehr gut da ich überwiegend
SPS Steuerungen Programmiere.
Ich benötige
mal eure Hilfe. Ich möchte einen Yamaha Revier über winHttp Befehle Steuern.
Ich habe einen Autoit Code der auch mit winHttp arbeitet und funktioniert.
Diese möchte ich in VBS umwandeln.
Bisher
funktioniert mein Code noch nicht. vielleicht kann mir jemand helfen.
Hier der Auto IT Code
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include <WinHTTP.au3>
Global $port=80
Global $ip="192.168.178.46"
Global $response=""
Global $PostDaten='<YAMAHA_AV cmd="PUT"><System><Power_Control><Power>On</Power></Power_Control></System></YAMAHA_AV>'
$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, $ip, $port)
$hRequest = _WinHttpOpenRequest($hConnect, "POST", "/YamahaRemoteControl/ctrl")
_WinHttpSendRequest($hRequest, 'Content-type: text/xml'&@CRLF, $PostDaten)
_WinHttpReceiveResponse($hRequest)
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)
exit
|
Hier der VBS Code bisher
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
Yamaha()
Sub Yamaha()
Dim result
Dim URL , postData
Dim winHttpReq
Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
URL = "http://192.168.178.46:80/YamahaRemoteControl/ctrl"
postDaten="<YAMAHA_AV cmd="PUT"><System><Power_Control><Power>On</Power></Power_Control></System></YAMAHA_AV>"
winHttpReq.Open "POST", URL, false
winHttpReq.SetRequestHeader "Content-type","text/xml"
winHttpReq.Send postDaten
End Sub
|