简体   繁体   中英

generic search script that searches a website for keyword

I looked at the SO question search script which find web page in website stored in database but the answer provided specific API's which would not make the program very generic. I am trying to write a script that will search a website using the website's search field, then click on an item on the website if a condition is met. I have no idea where to start with this and the only question relevant did not have the answer I was looking for. I'm not even sure whether PHP is a suitable language for the task. Maybe Python?

PHP is a suitable language. If you're trying to search for a term in a database, then MySQLi or PDO is your best option. Sanitise the search term, bind to the query and fetch the relevant result(s).

Do what as you would with the returned result set.

If I understood correctly, is this basically what you're asking?

Ruby's Mechanize is brilliant for performing web actions in an automated sense - http://mechanize.rubyforge.org/EXAMPLES_rdoc.html .

It's very powerful whilst being quick to learn and use.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM