I explain you my problem. I'd like to collect the content of around 1000 URL in a textfile (I use the wget function in a bash). And then I want to parse this textfile in order to pick one type of content up in a csv file.
1) So my bash is this one :
Code: Select all
file=/home/julien/tests/file.txt
for i in $(cat $file)
do
wget $i -O ->> songs_t.txt;
done2) Then I make a php script to parse songs_t.txt. I only want to get concert setlists (the setlist is only a part of a the content of each URL). So my approach is to remove tags such as 'a', 'h4', 'Title' and so on and save the rest in a csv file called 'SONGS.csv' An example of a URL can be seen here : http://members.tripod.com/~fun_fun_fun/8-17-63.html
My part of the php script dealing with the parsing is this one :
Code: Select all
$html = file_get_html('songs_t.txt');
foreach ($html->find('title, script, div, center, style, img, noscript, h4, a') as $es)
$es->outertext = 'title, script, div, center, style, img, noscript, h4, a';
$f = fopen('SONGS.csv', "w");
fwrite ($f, $html);
fclose($f);Code: Select all
Call to a member function find() on a non-object in /home/julien/tests/boys2.php on line 23.Code: Select all
foreach ($html->find('title, script, div, center, style, img, noscript, h4, a') as $es)Code: Select all
html = file_get_html('songs_t.txt');
if (!is_object($html)){
echo "invalid object";
} Could you help me please ?
Thanks !