Jump to content
Sign in to follow this  
seco

error when calling http.au3

Recommended Posts

seco

Hi

i try to use http.au3 with the following code

#include <HTTP.au3>

$host = "www.google.com"

ConsoleWrite("Example GET Request:"&@CRLF)
$socket = _HTTPConnect($host)
ConsoleWrite("Socket Created: "&$socket&@CRLF)
$get = _HTTPGet($host,0, $socket)

ConsoleWrite("Bytes sent: "&$get&@CRLF)
$recv = _HTTPRead($socket,1)
MsgBox(0,"",$recv)

If @error Then
    ConsoleWrite("_HTTPRead Error: "&@error&@CRLF)
    ConsoleWrite("_HTTPRead Return Value: "&$recv &@CRLF)
Else
    ConsoleWrite("HTTP Return Code: "&$recv[0]&@CRLF)
    ConsoleWrite("HTTP Return Response: "&$recv[1]&@CRLF)
    ConsoleWrite("Number of headers: "&UBound($recv[3])&@CRLF)
    ConsoleWrite("Size of data downloaded: "&StringLen($recv[4])&" bytes"&@CRLF)
    ConsoleWrite("Page downloaded: "&@CRLF&$recv[4]&@CRLF)
EndIf

_HTTPClose($socket)

it gives me error says :-

C:\Program Files\AutoIt3\Include\HTTP.au3(219,26) : ERROR: TimerStart(): undefined function.

Dim $timer = TimerStart()

any ideas?

thanks in advance.

Share this post


Link to post
Share on other sites
BrettF

Hi

i try to use http.au3 with the following code

#include <HTTP.au3>

$host = "www.google.com"

ConsoleWrite("Example GET Request:"&@CRLF)
$socket = _HTTPConnect($host)
ConsoleWrite("Socket Created: "&$socket&@CRLF)
$get = _HTTPGet($host,0, $socket)

ConsoleWrite("Bytes sent: "&$get&@CRLF)
$recv = _HTTPRead($socket,1)
MsgBox(0,"",$recv)

If @error Then
    ConsoleWrite("_HTTPRead Error: "&@error&@CRLF)
    ConsoleWrite("_HTTPRead Return Value: "&$recv &@CRLF)
Else
    ConsoleWrite("HTTP Return Code: "&$recv[0]&@CRLF)
    ConsoleWrite("HTTP Return Response: "&$recv[1]&@CRLF)
    ConsoleWrite("Number of headers: "&UBound($recv[3])&@CRLF)
    ConsoleWrite("Size of data downloaded: "&StringLen($recv[4])&" bytes"&@CRLF)
    ConsoleWrite("Page downloaded: "&@CRLF&$recv[4]&@CRLF)
EndIf

_HTTPClose($socket)

it gives me error says :-

C:\Program Files\AutoIt3\Include\HTTP.au3(219,26) : ERROR: TimerStart(): undefined function.

Dim $timer = TimerStart()

any ideas?

thanks in advance.

TimerStart = TimerInit

TimerDiff is also needed somewhere...

Share this post


Link to post
Share on other sites
PsaltyDS

That UDF was posted by OverloadUT, but he hasn't been around for over a year. There is a tweaked version at post #25 by Cubehead.

You could just tweak your own copy of HTTP.au3. I think replacing TimerStart() with TimerInit() was all that was required.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×