rpope904 Posted May 11, 2008 Share Posted May 11, 2008 I am attempting to write an ad-on for a banner exchange script, I am trying to write a mod to be run on a cron script once daily, what its going to do is connect to the exchange database, get the URLs of the members, open the site and search for our code in it.. It gets the urls, and opens them, but doesn't search for the code, or atleast say it does.. here's the code: <? echo "<b>Users found:</b><br> "; mysql_connect("localhost", "8888888888", "8888888888888"); mysql_select_db("888888888888"); $result = mysql_query("SELECT * FROM `ebp_ad` LIMIT 0, 30 "); while($row = mysql_fetch_array($result)){ file_get_contents($row[url]); if (preg_match("/^x10exchange/", '$data')) { echo "A match was found." .$row[url]. "<br>"; } else { echo "A match was not found." .$row[url]. "<br>"; } } ?> Basically, I just want it to search for x10exchange on the page, I know some of them have it.. Later on, I am going to code it to suspend the member if its not found, but this is just a test.. It returns them all as not found.. here's an example: http://x10exchange.com/forums/usercheck.php Quote Link to comment https://forums.phpfreaks.com/topic/105136-solved-searching-for-a-string/ Share on other sites More sharing options...
MadTechie Posted May 11, 2008 Share Posted May 11, 2008 on a v.quick look shouldn't if (preg_match("/^x10exchange/", '$data')) { be if (preg_match("/^x10exchange/", $data)) { (no single quotes on $data) Quote Link to comment https://forums.phpfreaks.com/topic/105136-solved-searching-for-a-string/#findComment-538287 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.