Sign in to follow this  
Followers 0
Izebize

PHP variables with COM Object

11 posts in this topic

How can I pass PHP variables with COM Object?

In the Help file there is a simple http com object example. Something like this:

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET","http://localhost/userlist.php?userid=3")
$oHTTP.Send()

Here's the userlist.php source:

<?php
$page = $_GET['userid'];
$log = fopen("users.txt", "a");
fwrite($log, $page ."\n");
fclose($log);
?>

If I open in a browser the url, it will save "3" into users.txt, but if I use the COM Object method, it won't write "3" into users.txt.

I tried $oHTTP.Open with "PUT", and "POST" too, without success.

What's wrong?

Share this post


Link to post
Share on other sites



Is it possible that the object is using a cached page?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I don't think so.

No, I tried with a different php filename, but it doesn't work.

Edited by Izebize

Share this post


Link to post
Share on other sites

So is the PHP file adding a blank line when you call it from the AutoIt script?

Share this post


Link to post
Share on other sites

Yes, I want to send data without showing a window, with php.

No, the php, doesn't add blank line.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I had same problem but I didn't find any solution with winhttprequest. But maybe it will work when you will add to http header:

Content-Type: application/x-www-form-urlencoded

You can also try this :

#include <INet.au3>
$users= _INetGetSource("http://localhost/userlist.php?userid=3")
Edited by Yuraj

ShellExecute("http://www.yuraj.ucoz.com")ProcessClose(@AutoItPID)

Share this post


Link to post
Share on other sites

_INetGetSource doesn't work.

How can I add header?

Share this post


Link to post
Share on other sites

If the PHP isn't adding a blank line (since it is reading a blank user is what you thought), that means that your script isn't even reaching the PHP host.

Do you have AutoIt allowed by your firewall?

Share this post


Link to post
Share on other sites

It's within local area, and I don't have firewall for it. I use firewall only for WAN. I'm sure it can reach the php.

I will check the sended packets with Wireshark and after I compared I'll post the differences.

Share this post


Link to post
Share on other sites

Firewalls block local traffic too. Make sure it's cleared.

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