Page 1 of 1

navigating a link, grabbing the text, parsing a string

Posted: Thu Mar 22, 2012 9:42 pm
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

--

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

Posted: Fri Mar 23, 2012 2:38 am
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

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

Posted: Thu Mar 29, 2012 8:41 pm
by inosent1
thanks!