This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's Calculator Programming subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. General Coding and Design => Calculator Programming
Author Message
todlangweilig


Advanced Member


Joined: 14 Feb 2006
Posts: 470

Posted: 10 Apr 2006 09:12:55 pm    Post subject:

I working on my dictionary word looker-uper, and ran into an issue. Some words will return one definition then a form where one may select other definitions of the word and the site will display them when clicked on. The problem is i dont know how to get to those pages because the url doesnt change, and im not sure how to simulate the submit function that comes with html in python.

example:
looking up the word 'move'
http://www.m-w.com/cgi-bin/dictionary?book...tionary&va=move

i would like to be able to get the source, from the page, when you click "move[2,noun]"


Last edited by Guest on 10 Apr 2006 09:13:28 pm; edited 1 time in total
Back to top
elfprince13
Retired


Super Elite (Last Title)


Joined: 11 Apr 2005
Posts: 3500

Posted: 10 Apr 2006 11:38:53 pm    Post subject:

you use either the GET or POST headers in the http request that you send.

however you also can specify the form input and its name in pairs like so:

name=value&name2=othervalue.


Last edited by Guest on 10 Apr 2006 11:39:41 pm; edited 1 time in total
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 11 Apr 2006 05:38:13 am    Post subject:

Which are GET variables..
Back to top
elfprince13
Retired


Super Elite (Last Title)


Joined: 11 Apr 2005
Posts: 3500

Posted: 11 Apr 2006 06:55:21 am    Post subject:

or POST variables....
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 11 Apr 2006 07:15:27 am    Post subject:

POST variables don't show up in the URL. ; )
Back to top
elfprince13
Retired


Super Elite (Last Title)


Joined: 11 Apr 2005
Posts: 3500

Posted: 11 Apr 2006 07:47:44 am    Post subject:

he was saying the URL doesn't change :D

and they are still sent using the key-value pairs.

you should try using httplib instead of urllib.


Last edited by Guest on 11 Apr 2006 07:48:59 am; edited 1 time in total
Back to top
todlangweilig


Advanced Member


Joined: 14 Feb 2006
Posts: 470

Posted: 11 Apr 2006 02:39:56 pm    Post subject:

I plan on using httplib. If you could help me with it, that'd be great.

to clarify the url thing:

its starts like this
http://www.m-w.com/cgi-bin/dictionary?book...tionary&va=move

when you click on the form it changes into this
http://www.m-w.com/cgi-bin/dictionary
and refreshes the page

I did a little research into HTTP on wikipedia yesterday, i imagine i would use the POST method because its for submitting user data.

If i were to give you guys some of the relevent html code, could u tell me what values i need to give to the server to get page "blah[2,adjective]"?


Code:
<form name="entry"  method=post action="/cgi-bin/dictionary"><table border="0" cellpadding="0" cellspacing="0" valign="top"><tr><td>
<input type=hidden name=hdwd value="blah"><input type=hidden name=listword value="blah"><input type=hidden name=book value=Dictionary> <select style="font-family:arial;font-size:9pt;" name=jump size=2 onChange="document.entry.submit(this.form)">
<option>blah[1,noun]
<option>blah[2,adjective]
</select><input type=hidden name=list value="blah[1,noun]=105178;blah[2,adjective]=105195"></td><td valign="top">
&nbsp;<input type=submit value="Go"></td></tr></table>
</form>
Back to top
elfprince13
Retired


Super Elite (Last Title)


Joined: 11 Apr 2005
Posts: 3500

Posted: 11 Apr 2006 04:41:56 pm    Post subject:

all the name attributes are the first part of the pair and the value attribute inside the same tag is the second part.

So:

Code:
<input type="hidden" name=cheese value="no">


becomes


Code:
cheese=no
Back to top
todlangweilig


Advanced Member


Joined: 14 Feb 2006
Posts: 470

Posted: 11 Apr 2006 04:49:47 pm    Post subject:

Would i need to do the name/value thing for all of input tags or just some of them?
Back to top
elfprince13
Retired


Super Elite (Last Title)


Joined: 11 Apr 2005
Posts: 3500

Posted: 11 Apr 2006 05:04:22 pm    Post subject:

all of them.
Back to top
todlangweilig


Advanced Member


Joined: 14 Feb 2006
Posts: 470

Posted: 11 Apr 2006 05:20:01 pm    Post subject:

I've got this so far, do these look correct?

hdwd=blah
listword=blah
book=Dictionary
list=blah[1,noun]=105178;blah[2,adjective]=105195


what do i do for the rest though

<form name="entry" method=post action="/cgi-bin/dictionary">
<select style="font-family:arial;font-size:9pt;" name=jump size=2 onChange="document.entry.submit(this.form)">
<input type=submit value="Go">
Back to top
elfprince13
Retired


Super Elite (Last Title)


Joined: 11 Apr 2005
Posts: 3500

Posted: 11 Apr 2006 07:57:14 pm    Post subject:

send the HTTP POST information to the /cgi-bin/dictionary on the site you are using


here is an example of what you want in Java.


Last edited by Guest on 11 Apr 2006 08:00:27 pm; edited 1 time in total
Back to top
DarkStrike


Newbie


Joined: 11 Apr 2006
Posts: 16

Posted: 11 Apr 2006 08:14:23 pm    Post subject:

didnt he want it in html? i prefer java too Razz
Back to top
elfprince13
Retired


Super Elite (Last Title)


Joined: 11 Apr 2005
Posts: 3500

Posted: 11 Apr 2006 08:15:57 pm    Post subject:

He's doing it in Python, but I dont have an examples in Python and Im too lazy to type one up.

plus, once you can read one high level language you can read any of them.

writing in them is a different matter of course....
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement