ldigital Posted February 1, 2013 Share Posted February 1, 2013 Hi, I am working on a PHP file and need it to open a URL and if there is a certain word or phrase on the web page then open a second URL. If the text is not there, then I need the first URL to continually open until the text is found. I would imagine this is pretty simple, something like an IF statement and a loop somewhere. But how do I do this? Any help would be greatly appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/273924-php-file-to-check-for-text-run-command-if-its-found/ Share on other sites More sharing options...
TuQuoQueBrute Posted February 1, 2013 Share Posted February 1, 2013 (edited) <?php while( 1 == 1 );{ $word=blablabla; $aa=get_file_contents('http://blablaurl.com/bla.bla') if (strstr($aa, "$word") == True) { echo Word found ; get_file_contents('http://blablablaSecondUrl'); exit(); }else{ } } ?> Hey this is air code i hope that this is not wrong im not shure if the loop (while()) will work . set the $word var to the text that you want to find set the http://blablaurl.com/bla.bla to the page that you want to find the text set http://blablablaSeco...laSecondUrl to the second url if the while loop dont work try other syntaxe or Do while Or try to figure it out Edited February 1, 2013 by TuQuoQueBrute Quote Link to comment https://forums.phpfreaks.com/topic/273924-php-file-to-check-for-text-run-command-if-its-found/#findComment-1409590 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.