snk Posted December 10, 2007 Share Posted December 10, 2007 hello, Can you tell me a general idea about how can i place the text content of a webpage in a string arraylist? No a particular code, even if i dont mind , just a general idea. Thank you Link to comment https://forums.phpfreaks.com/topic/80955-solved-put-in-array-list-the-content-of-an-other-webpage/ Share on other sites More sharing options...
trq Posted December 10, 2007 Share Posted December 10, 2007 file_get_contents(). Link to comment https://forums.phpfreaks.com/topic/80955-solved-put-in-array-list-the-content-of-an-other-webpage/#findComment-410675 Share on other sites More sharing options...
snk Posted December 10, 2007 Author Share Posted December 10, 2007 When I run the below code $str=file_get_contents("http://www.test.com/sub/notes.html",FALSE,1024); echo $str; i receive a warning Warning: file_get_contents() expects at most 2 parameters, 3 given...... and it doesnt echoes the $srt Can somebody helps? Link to comment https://forums.phpfreaks.com/topic/80955-solved-put-in-array-list-the-content-of-an-other-webpage/#findComment-410712 Share on other sites More sharing options...
trq Posted December 10, 2007 Share Posted December 10, 2007 <?php $str = file_get_contents("http://www.test.com/sub/notes.html"); echo $str; ?> Link to comment https://forums.phpfreaks.com/topic/80955-solved-put-in-array-list-the-content-of-an-other-webpage/#findComment-410737 Share on other sites More sharing options...
snk Posted December 10, 2007 Author Share Posted December 10, 2007 <?php $search_criteria = "help"; $str = file_get_contents("http://www.dcs.napier.ac.uk/~cs170/32037lnotes.html"); $word = explode(" ",$str); for (i=0; i< sizeof($word); i++) { if ($word[i] == $search_criteria){ ?> <span class="style1"><?php echo $word[i]; ?></span> <?php i=i++; $size++; } echo $word[i]; } ?> I get a blank page, and it looks so perfect... can somebody confirm that for (i=0; i< sizeof($word); i++) is valid code? thanks. Link to comment https://forums.phpfreaks.com/topic/80955-solved-put-in-array-list-the-content-of-an-other-webpage/#findComment-410745 Share on other sites More sharing options...
~n[EO]n~ Posted December 10, 2007 Share Posted December 10, 2007 You missed $ before all i's Link to comment https://forums.phpfreaks.com/topic/80955-solved-put-in-array-list-the-content-of-an-other-webpage/#findComment-410750 Share on other sites More sharing options...
snk Posted December 10, 2007 Author Share Posted December 10, 2007 thank you m8... its 6.20 am and i cant see the monitor anymore.... Link to comment https://forums.phpfreaks.com/topic/80955-solved-put-in-array-list-the-content-of-an-other-webpage/#findComment-410754 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.