#!/usr/local/bin/php
")) {
if ($name != "") {
print "$name,$href,$company,$volpage,$insttype,$county,$instdate,$term,$royalty,$record_date,$effective,$area,$grantee\n";
$start = 0;
$name = "";
$href ="";
$name = "";
$company = "";
$volpage = "";
$insttype = "";
$county = "";
$instdate = "";
$term="";
$royalty="";
$record_date="";
$effective="";
$area="";
$grantee="";
}
}
if ($start == 1) {
if ($count == 13) {
$grantee=trim(strip_tags($line));
$count++;
}
if ($count == 12) {
$area=trim(strip_tags($line));
$count++;
}
if ($count == 11) {
$effective=trim(strip_tags($line));
$count++;
}
if ($count == 10) {
$record_date=trim(strip_tags($line));
$count++;
}
if ($count == 9) {
$term=trim(strip_tags($line));
$count++;
}
if ($count == 8) {
$instdate=trim(strip_tags($line));
$count++;
}
if ($count == 7) {
$county=trim(strip_tags($line));
$count++;
}
if ($count == 6) {
$insttype=trim(strip_tags($line));
$count++;
}
if ($count == 5) {
$volpage=trim(strip_tags($line));
$count++;
}
if ($count == 4) {
$company=trim(strip_tags($line));
$count++;
}
if ($count == 3) {
$regexp = "]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
$href = "";
if(preg_match_all("/$regexp/siU", $input, $matches)) {
$href = "http://www.drillinginfo.com".$matches[2][0];
}
$name = trim(strip_tags($line));
$count++;
}
if ($count == 2) {
//$grantee=trim(strip_tags($line));
$count++;
}
if ($count == 1) {
$count++;
}
if ($count == 0) {
$count++;
}
}
if (strstr($line,"stbl even") || strstr($line,"stbl odd")) {
$start = 1;
$count = 0;
}
}
}
curl_close($crl);
function postStuff($url,$ckfile,$crl,$stuff) {
$agent = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27';
curl_setopt($crl, CURLOPT_URL, $url);
curl_setopt($crl, CURLOPT_USERAGENT, $agent);
curl_setopt($crl, CURLOPT_COOKIEJAR, $ckfile);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($crl, CURLOPT_POST, 1);
curl_setopt($crl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($crl, CURLOPT_POSTFIELDS, $stuff);
$result = curl_exec($crl);
$header = curl_getinfo($crl);
return $result;
}
function getURL($url,$ckfile,$ch) {
//$ch = curl_init($url);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-us) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27');
curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile);
$output = curl_exec($ch);
//curl_close($ch);
return $output;
}
?>