navigating a link, grabbing the text, parsing a string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

navigating a link, grabbing the text, parsing a string

Post by inosent1 »

a while back i was using visual basic progs to grab data from the internet

i would load a text file with web links, hit one at a time, grab the text, place the text in memory, find the text on the page i was looking for, save that to a file, and then loop to the next link until i was all done.

is there a way to do that using php?

eg


go to: site.com/page1.htm
read the html text into a variable $file_a
look for the term "widget" found between "small" and "large" on each page
store that item in a variable $found
go to next link

--
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: navigating a link, grabbing the text, parsing a string

Post by social_experiment »

To read a file into a string
http://www.php.net/manual/en/function.f ... ntents.php
For the searching option you can look at regular expressions;
http://www.php.net/manual/en/book.pcre.php
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

Re: navigating a link, grabbing the text, parsing a string

Post by inosent1 »

thanks!
Post Reply