Zohar Posted August 10, 2012 Posted August 10, 2012 (edited) HiI am experimenting with HTTP Post in AutoIt,and I am trying to create a simple example that will work.The Form is:<form method="post" action="/ssearch.asp" id="srchForm"> <div class="searchBtn" onClick="$('#srchForm').submit();"> <input type="text" size="45" name="search" value="" class="txt" autocomplete="off"/> </form>And my code is:IECreate("") $oIE.Navigate2("torec.net/ssearch.asp",0,"","search=test")When running this script,the resulting webpage shows:"server error" .What do I need to add/fix to make it work?I specifically chose a simple example(tho not the most useful), just so I can make it work.Thank you Edited August 10, 2012 by Zohar
MrMitchell Posted August 10, 2012 Posted August 10, 2012 There are a bunch of threads that are either all about this issue or at least mention it. Here are a couple... although they are old I can't find any newer threads about it
Zohar Posted August 10, 2012 Author Posted August 10, 2012 I went over existing threads before creating this one. All the older ones do not succeed. It's pretty ironics since this is a basic things, it should be simple. I wonder what I'm missing.
BrewManNH Posted August 10, 2012 Posted August 10, 2012 You're missing a quote here: $oIE.Navigate2("http://www.torec.net/ssearch.asp",0,"","search=test") If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Zohar Posted August 10, 2012 Author Posted August 10, 2012 (edited) HiYou're right,It was a problem when pasting it here. My original code contains all needed ""s..,And the result("server error") happens when the code contains all needed ""s..So it still needs some fix.. Edited August 10, 2012 by Zohar
DaleHohm Posted August 10, 2012 Posted August 10, 2012 (edited) Please try to post working code. Yours had lots of syntax errors. Do this: #include <IE.au3> $oIE = _IECreate("") $oIE.Navigate2("http://www.torec.net/ssearch.asp"]http://www.torec.net/ssearch.asp", 0x1, "_self", Binary("search=test"), "Content-Type: application/x-www-form-urlencoded") Dale Edited August 10, 2012 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
Zohar Posted August 10, 2012 Author Posted August 10, 2012 (edited) Please try to post working code. Yours had lots of syntax errors. Yes, because when I pasted here the code, that contained a URL, the forums system converted the URL text and added many things between it.. (the original code that I used on my pc did not have all these problems) Do this: #include <IE.au3> $oIE = _IECreate("") $oIE.Navigate2("torec.net/ssearch.asp", 0x1, "_self", Binary("search=test"), "Content-Type: application/x-www-form-urlencoded") This one worked!!! Apparantly what was missing were 2 things: 1) Binary() around the POST Data, 2) The Additional Header you provided("Content-Type: application/x-www-form-urlencoded") Thank youv ery much! BTW, The 0x1, and the "_self" parts, seem not to be needed. Thank you very much Dale :] Edited August 10, 2012 by Zohar
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