Welcome to Dream.In.Code
Become a PHP Expert!

Join 137,424 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,959 people online right now. Registration is fast and FREE... Join Now!




PREG_MATCH_ALL - Not matching all the time..

 
Reply to this topicStart new topic

PREG_MATCH_ALL - Not matching all the time.., Issue with PREG_MATCH_ALL

ellisgl
7 Jan, 2008 - 08:44 AM
Post #1

D.I.C Head
**

Joined: 10 Nov, 2007
Posts: 68



Thanked: 1 times
My Contributions
Here's the code:
CODE

<?php
$url = 'http://www.ci.dallas.tx.us/dpd/cgi-bin/sexoffender.pl';
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'queryby=2&zip=75252');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
$content = curl_exec ($ch); # This returns HTML

curl_close ($ch);

$a = '/<HTML><HEAD>
<TITLE>Sex Offenders in the ([^`]*?) Area<\/TITLE>
<\/HEAD>
<BODY BGCOLOR="#FFFFFF" link="#0000FF" vlink="#0000FF">
([^`]*?)
<P><HR><P>
<form>
<div align="center"><input type="button" value="Previous Page" onclick="history.back\(\)">
<\/div>
<\/form>
<\/BODY><\/HTML>/';

preg_match_all($a, $content, $matches1);

echo '<pre>';
print_r($matches1);
echo '</pre>';
?>

Ok - This works unless I change:
curl_setopt($ch, CURLOPT_POSTFIELDS, 'queryby=2&zip=75252');

to:

curl_setopt($ch, CURLOPT_POSTFIELDS, 'queryby=2&zip=75208');

I can't find out what would be killing it off.

Even Regex Buddy shows its to be valid.

The initial form is at:
http://www.ci.dallas.tx.us/dpd/sexoffendersrequest.htm

This post has been edited by ellisgl: 7 Jan, 2008 - 08:51 AM
User is offlineProfile CardPM
+Quote Post

ellisgl
RE: PREG_MATCH_ALL - Not Matching All The Time..
7 Jan, 2008 - 09:55 AM
Post #2

D.I.C Head
**

Joined: 10 Nov, 2007
Posts: 68



Thanked: 1 times
My Contributions
Ok - after putting this code on a linux server (was running on my laptop - windows) it's 100%... Don't know why.

So it looks to be a PHP Windows issue I believe.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/5/08 04:37AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month