- Сообщения
- 7,790
- Репутация
- 2,323
Arei [?]
Так у меня на XP работает:
Так нет.у вас он работает?
Так у меня на XP работает:
Код:
#include 'WinHttp.au3'
$sResult = ''
$sHeader = ''
$iError = 1
$hFile = FileOpen(@ScriptDir & '\1.flac', 16)
$bRead = FileRead($hFile)
FileClose($hFile)
If Not $bRead Then Exit
For $i = 1 To 1
$hOpen = _WinHttpOpen('Chrome/14.0.835.202')
If @error Then ExitLoop
$hConnect = _WinHttpConnect($hOpen, 'www.google.com')
If @error Then ExitLoop
$hRequest = _WinHttpOpenRequest($hConnect, 'POST', '/speech-api/v1/recognize?xjerr=1&client=chromium&lang=ru-RU')
If @error Then ExitLoop
_WinHttpAddRequestHeaders($hRequest, 'Content-Type: audio/x-flac; rate=8000')
If @error Then ExitLoop
_WinHttpSendRequest($hRequest, 'Accept: */*', $bRead, BinaryLen($bRead))
If @error Then ExitLoop
_WinHttpReceiveResponse($hRequest)
If @error Then ExitLoop
If _WinHttpQueryDataAvailable($hRequest) Then
$sResult = _WinHttpReadData($hRequest, 1)
$sHeader = _WinHttpQueryHeaders($hRequest)
$iError = 0
Else
MsgBox(16, 'Error', 'Error')
EndIf
Next
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)
If $iError Then
ConsoleWrite('Error' & @LF)
Else
ConsoleWrite('sHeader: ' & $sHeader & @LF)
ConsoleWrite('------------------' & @LF)
ConsoleWrite('sResult: ' & $sResult & @LF)
ConsoleWrite('Word: ' & StringRegExpReplace($sResult, '.*utterance":"(.*?)","confidence.*', '$1') & @LF)
EndIf