Izebize Posted April 14, 2009 Share Posted April 14, 2009 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? Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 14, 2009 Share Posted April 14, 2009 Is it possible that the object is using a cached page? Link to comment Share on other sites More sharing options...
Izebize Posted April 14, 2009 Author Share Posted April 14, 2009 (edited) I don't think so. No, I tried with a different php filename, but it doesn't work. Edited April 14, 2009 by Izebize Link to comment Share on other sites More sharing options...
DJKMan Posted April 15, 2009 Share Posted April 15, 2009 So in a way you want to send data without showing a window? Â Â Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 15, 2009 Share Posted April 15, 2009 So is the PHP file adding a blank line when you call it from the AutoIt script? Link to comment Share on other sites More sharing options...
Izebize Posted April 15, 2009 Author Share Posted April 15, 2009 Yes, I want to send data without showing a window, with php. No, the php, doesn't add blank line. Link to comment Share on other sites More sharing options...
Yuraj Posted April 15, 2009 Share Posted April 15, 2009 (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 April 15, 2009 by Yuraj ShellExecute("http://www.yuraj.ucoz.com")ProcessClose(@AutoItPID) Link to comment Share on other sites More sharing options...
Izebize Posted April 15, 2009 Author Share Posted April 15, 2009 _INetGetSource doesn't work. How can I add header? Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 15, 2009 Share Posted April 15, 2009 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? Link to comment Share on other sites More sharing options...
Izebize Posted April 15, 2009 Author Share Posted April 15, 2009 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. Link to comment Share on other sites More sharing options...
Richard Robertson Posted April 15, 2009 Share Posted April 15, 2009 Firewalls block local traffic too. Make sure it's cleared. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now