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 Quote 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(). Quote 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? Quote 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; ?> Quote 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. Quote 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 Quote 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.... Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.