Sign in to follow this  
Followers 0
DOTCOMmunications

HTTP UDF and non standard ports

6 posts in this topic

Hi all

We run an internal webserver on port 9999 and are trying to use the HTTP UDF to send POST data to a php page on that server.

The code we have at the moment is:

#include <Array.au3>
#include "http.au3"

$testNE = "result=test"
$testE = _HTTPEncodeString($testNE)

$connection = _HTTPConnect("lcars", 9999)
$bytes = _HTTPPost("lcars:9999", "/test/posttest.php", $connection, $testE)
MsgBox(64, "Bytes Sent", $bytes)
$result = _HTTPRead()
MsgBox(64, "Result", $result)
sleep(2000)
Exit

The problem is that when we run this the data is sent (bytes is about 189) but the result returned is the 404 page, i have confirmed the file is there by accessing it manually. Also if we change the port number to the default (80) then it also works okay by changing the _HTTPConnect line to 80 and the _HTTPPost to just lcars

Any ideas on how to resolve this?

Regards

Adam Mallinson

DOT-COMmunications

Share this post


Link to post
Share on other sites



Anyone got any ideas?

Share this post


Link to post
Share on other sites

What UDF is that? Googling http.au3 returned Which was last updated in 2007. I'm not saying it won't work anymore, but people might not go through the effort of searching and downloading that UDF to help you.

Instead I reccomend the very well documented and by trancexx for the following reasons:

  • It's very well documented.
  • I can confirm it works with more ports than just 80 and 443. (any port I tried so far worked as expected)
  • Many people are familliar with it.
  • The author keeps a close eye on these forums in case you get stuck.

Share this post


Link to post
Share on other sites

If your using the UDF I think your using then you need to change a line in the UDF that the person who created it missed.

Find this line in the _HTTPConnect() function

Dim $socket = TCPConnect ( $ip, 80 )

And change it to this

Dim $socket = TCPConnect ( $ip, $port )

[size="1"]Please stop confusing "how to" with "how do"[/size]

Share this post


Link to post
Share on other sites

people might not go through the effort of searching and downloading that UDF to help you.

I stand corrected. The helpfullness of Deltaforce229 exceeds all expectations! :graduated:

Share this post


Link to post
Share on other sites

If your using the UDF I think your using then you need to change a line in the UDF that the person who created it missed.

Find this line in the _HTTPConnect() function

Dim $socket = TCPConnect ( $ip, 80 )

And change it to this

Dim $socket = TCPConnect ( $ip, $port )

Thanks for that Deltaforce229

I made the change you mentioned but when i try it again it now returns invalid URL in <h1> tags

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