943,735 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 791
  • Python RSS
Jan 5th, 2009
0

query inside a webpage with Python

Expand Post »
Hi,
I want to perform a search with Python in this site:
http://www.draftexpress.com/search.php

I want to search for a player who's first name is "james".
The problem: The page with the result's url is:
http://www.draftexpress.com/search.php#results

Obviously, when opening this page directly, I don't get the page with the results for "james"...

I need to perform this kind of search automatically in other sites like that, so I don't want any local solution, if there is.

I need to make my program somehow make this query and I don't know how. Do anyone have a suggestion? (A code example would be great).

Help me please...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
noamjob is offline Offline
4 posts
since Jan 2009
Jan 6th, 2009
0

Re: query inside a webpage with Python

This is the essential parts of the 'source' for the basic search form extracted from the web page you indicated:

html Syntax (Toggle Plain Text)
  1. <form action="/search.php#results" method="post">
  2. <strong>Basic Search </strong>
  3. <strong>First Name:</strong><br> <input name="fFIRSTNAME" type="text" size="10" maxlength="25" value="">
  4. <strong>Last Name:</strong><br> <input name="fLASTNAME" type="text" size="10" maxlength="25" value="">
  5. </form>

The <form> tells you that the form data is sent to the server via post, and the <input>'s give the field names 'fFIRSTNAME' and 'fLASTNAME'

You then 'encode' the form data and post it to the server.

There's a pretty good article on how to do that here:

http://www.voidspace.org.uk/python/a.../urllib2.shtml
Reputation Points: 344
Solved Threads: 116
Practically a Master Poster
Murtan is offline Offline
670 posts
since May 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Google Results and Python
Next Thread in Python Forum Timeline: Edraw max is given away





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC