The Little Guy Posted November 13, 2007 Share Posted November 13, 2007 <?php include'../incl/includes.php'; $query = sprintf("SELECT * FROM sites WHERE id = '%s' ORDER BY RAND() LIMIT 1",mysql_real_escape_string($_GET['id'])); $sql = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($sql); $site = http_get($row['url'],$ref=''); if(preg_match('~<script type="text/javascript" src="http://trafficexchange.phpsnips.com/javascripts/jsProcess.php?id=(.*)"></script>~',$site['FILE'])){ $f = 'found'; }else{ $f = 'not found'; } ?> OK my preg_match isn't working $site = http_get($row['url'],$ref=''); -- This function returns the site, along with it's html my preg_match is looking for: http://trafficexchange.phpsnips.com/javascripts/jsProcess.php?id=(.*) if I Echo out the $site['FILE'] I get everything on the page, including: <!-- Start Traffic Exchange --> <script type="text/javascript" src="http://trafficexchange.phpsnips.com/javascripts/jsProcess.php?id=1"></script> <!-- End Traffic Exchange --> The PHP page output: http://trafficexchange.phpsnips.com/javascripts/jsProcess.php?id=1 what it is doing is always saying "not found" when I echo out $f whether or not this is on the page: http://trafficexchange.phpsnips.com/javascripts/jsProcess.php?id=(.*) Quote Link to comment https://forums.phpfreaks.com/topic/77234-solved-preg_match/ Share on other sites More sharing options...
effigy Posted November 13, 2007 Share Posted November 13, 2007 . and ? are metacharacters. They should be escaped with a backslash. Quote Link to comment https://forums.phpfreaks.com/topic/77234-solved-preg_match/#findComment-391021 Share on other sites More sharing options...
The Little Guy Posted November 13, 2007 Author Share Posted November 13, 2007 ah... ok I escaped everything except for those thanks! Quote Link to comment https://forums.phpfreaks.com/topic/77234-solved-preg_match/#findComment-391025 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.