Jump to content
Sign in to follow this  
redfire

Errors with WinHTTP Post

Recommended Posts

redfire

Hi and Good day,

I tried something today with WinHTTP to send data to a php file and i get some compilation errors. here is my code.

#include <inet.au3>

$ip = _GetIP()
$username = @UserName
$computername = @ComputerName
$osversion = @OsVersion

; string data info

$info = $ip & "|" & $username & "|" & $computername & "|" & $osversion

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST" , "gate.php" , False)
$oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 4.0.20506)")
$oHTTP.SetRequestHeader("Referrer", "http://www.REFERRERURL.com")
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.Send($info)

MsgBox(11,"Message","HTTPRequest Complete")

Please check for errors, i am new to this one too.

Edited by redfire

Share this post


Link to post
Share on other sites
redfire

I am sending it to a server, I am using lo

1) If gate.php is just a local file it will not work

 

2) what errors are YOU getting?

 

3) It is worth trying the WinHTTP UDF made by TranceXX () for POST and GET Operations

Hello, thank you again,

How do you mean a local file? I want it to send data to a file in my localhost serveer , it keeps pointing my error, I suggest u compile and run to see the errors, its not saying anything about winhttp udf, kindly see for yourself how it goes.

Share this post


Link to post
Share on other sites
mrflibblehat

The only error I get is from not being able to connect to gate.php, which is what I would expect.

the host address should be the full url to your localhost server, not just gate.php

If you are receiving different errors to this please show here what SCITE outputs.

Edited by mrflibblehat

[font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font]

Share this post


Link to post
Share on other sites
redfire

The only error I get is from not being able to connect to gate.php, which is what I would expect.

the host address should be the full url to your localhost server, not just gate.php

If you are receiving different errors to this please show here what SCITE outputs.

When you say, connect to the full url, kindly help me with a source code, let me see where the erros are.

Do you mean something like this :

$oHTTP.Open("POST","http://localhost","gate.php" False)

I am a bit lost here

Edited by redfire

Share this post


Link to post
Share on other sites
mrflibblehat

$oHTTP.Open("POST", "http://localhost/gate.php", False)

Try This.

Edited by mrflibblehat

[font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font]

Share this post


Link to post
Share on other sites
redfire
$oHTTP.Open("POST", "http://localhost/gate.php", False)

Try This.

 

$oHTTP.Open("POST", "http://localhost/gate.php", False)

Try This.

 

Okay i tried it now, works fine now it brings out another error different from the first one.

screen.png

The $oHTTP.Send($info) is like having errors. why is that? 

Share this post


Link to post
Share on other sites
mrflibblehat

Looks like it is unable to complete the operation, which suggests it is unable to connect to that URL. 

Can you access http://localhost/gate.php manually?

looks like ths syntax is correct

Edited by mrflibblehat

[font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font]

Share this post


Link to post
Share on other sites
redfire

Looks like it is unable to complete the operation, which suggests it is unable to connect to that URL. 

Can you access http://localhost/gate.php manually?

looks like ths syntax is correct

 

Looks like it is unable to complete the operation, which suggests it is unable to connect to that URL. 

Can you access http://localhost/gate.php manually?

looks like ths syntax is correct

 

Hello, Were you able to decode where the errors were? Please Let me know what you came up with, I am still having the same errors. Please Let me know so i can correct.

Thanking you.

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  

×