Sign in to follow this  
Followers 0
GooG

HTTP UDF help

4 posts in this topic

Hi,

I've been playing around a little with Greg Laabs HTTP UDF and found out that can't request two pages from the same stocket!?:

CODE
#include <HTTP.au3>

$socket = _HTTPConnect("www.autoitscript.com")

_HTTPPost("www.autoitscript.com", "/", $socket)

$Response = _HTTPRead($socket)

MsgBox(0, "", $Response)

_HTTPGet("www.autoitscript.com", "/", $socket)

$Response = _HTTPRead($socket)

MsgBox(0, "", $Response)

_HTTPClose($socket)

The second _HTTPRead is just returning "0" and @error 3 timeout, why?

I've also been trying to get the headers from a page:

CODE
#include <HTTP.au3>

$socket = _HTTPConnect("www.autoitscript.com")

_HTTPPost("www.autoitscript.com", "/", $socket)

$Response = _HTTPRead($socket, 1)

MsgBox(0, "", $Response[3][0])

MsgBox(0, "", $Response[3][1])

_HTTPClose($socket)

But its just returning:

Array variable has incorrect number of subscripts or subscript dimension range exceeded.

What am I doing wrong?

Share this post


Link to post
Share on other sites



the array entry [3] itself is a 2 dimensional array and you would be referring to some non existing array.

my return value is called data here.

this should help:

$newdata = $data[3]
MsgBox(0, "", $newdata[0][1])

to easily scout what your array(s) contain i like to use:

_ArrayDisplay($array)

use it like this in your example:

_ArrayDisplay($data[3])

Share this post


Link to post
Share on other sites

_ArrayDisplay($data)

Is correct. Never seen it like $data[3] before... :D

it is correct in this case tho because $data[3] itself is a 2 dimensional array.

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  
Followers 0