Jump to content

HTTP UDF and non standard ports


Recommended Posts

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

Link to comment
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.
Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...