This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Eggdrop HTTP Post

Help for those learning Tcl or writing their own scripts.
Post Reply
k
kenneal
Voice
Posts: 10
Joined: Sun Mar 11, 2007 8:21 am

Eggdrop HTTP Post

Post by kenneal »

I've done a few website parsing scripts myself but I need help on the POST techniques.

This is the extracted form code

;;;;;;;;;;;;;;;;;;;;;;;;;;;started html code

<form method=POST onSubmit="openpage()" action=fetch.php enctype=multipart/form-data>
<table border=0 cellspacing=0 cellpadding=0 align=center>
<tr align=center>
<td align=center>
</td>
</tr>
<tr height=27 valign="bottom">
<table border=0 cellspacing=0 cellpadding=0>
<tr>
<td>
<font size=3 color=#ff6600>Enter your code</font>

<input type=text name=code size=30 value=OPwDA3NR2G >

</td>
<td valign="bottom">
<input type="submit" height=27 width=174 border=0 valign="bottom" value="Download">

;;;;;;;;;;;;;;;;;;;;;;;;end of html code

I am trying to make the eggdrop download the file automatically but first of all how can I go about POSTing to the fetch.php with the relevant input code "OPwDA3NR2G".
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

Look at any of half of the webscripts I've done, many of them use POST. The xe currency script, iplocator.tcl, earthcal, and a script I made for DimeaDozen.com to create accounts automagically.

The dime script might be the better example of grabbing a piece of the html form, for resubmitting back into the form, although that is a commandline script, not strictly speaking an eggdrop script.. Not hard to convert to eggdrop tho, just change puts to puthelp's for showing output, and such. You can find that one here:

http://members.dandy.net/~fbn/dime-signup.tcl.txt

Basically all you're doing is using regexp to grab whatever data you need to feed into the form, and then using http::formatQuery to stuff it back with http::geturl -query $querydata

From looking at your html, formatQuery would be: code "OPwDA3NR2G"
k
kenneal
Voice
Posts: 10
Joined: Sun Mar 11, 2007 8:21 am

Post by kenneal »

Thanks, works like a gem :) Cheerios! :P
Post Reply