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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.