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.htmThis post has been edited by ellisgl: 7 Jan, 2008 - 08:51 AM