Jump to content

[SOLVED] Preg_Match


The Little Guy

Recommended Posts

<?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=(.*)

Link to comment
https://forums.phpfreaks.com/topic/77234-solved-preg_match/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.