RSS Forums RSS

query inside a webpage with Python

Please support our Python advertiser: Programming Forums
Thread Solved
Reply
Posts: 4
Reputation: noamjob is an unknown quantity at this point 
Solved Threads: 0
noamjob noamjob is offline Offline
Newbie Poster

query inside a webpage with Python

  #1  
Jan 5th, 2009
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...
AddThis Social Bookmark Button
Reply With Quote  
Posts: 524
Reputation: Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough Murtan is a jewel in the rough 
Solved Threads: 78
Murtan Murtan is offline Offline
Posting Pro

Re: query inside a webpage with Python

  #2  
Jan 6th, 2009
This is the essential parts of the 'source' for the basic search form extracted from the web page you indicated:

  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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the Python Forum
Views: 308 | Replies: 1 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:31 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC