curl-and-php
Cannot retrieve php/mysql web page
Date: Fri, 11 Aug 2006 16:45:01 -0700 (PDT)
I have read many posts here and on php.net, but I
cannot do a capture (Web page scraping?) from my
php/mysql generated web page.
The webpage, conxritedwg.php, reads data from a mysql
database (on a different domain, btw), then generates
a the output.
The only content I can capture is my header and footer
(all static information). No data from the database.
I've tried many other options, but to no avail.
I simply want to capture the exact content that the
client sees and save it to the server.
I feel that PHPSESSID may be a problem, or because the
MySQL database is on a different domain.
Here is the latest code I've tried (cobbled together
from several sources here and php.net):
// Function to grab the screen
function GrabURL($ID) {
$doc_root = $_SERVER['DOCUMENT_ROOT'];
$curl_handle=curl_init();
$fp = fopen("$doc_root/vccpmp3/dwgs/dwg$ID.html",
"w");
curl_setopt($curl_handle,CURLOPT_URL,"http://www.vcclite.com/vccpmp3/conxritedwg.php");
// curl_setopt($curl_handle,CURLOPT_VERBOSE, 1);
// curl_setopt($curl_handle,CURLOPT_HEADER, 1);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,60);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl_handle,CURLOPT_FOLLOWLOCATION,1);
curl_setopt($curl_handle, CURLOPT_COOKIEJAR,
"$doc_root/vccpmp3/cookies$ID.txt");
curl_setopt($curl_handle, CURLOPT_COOKIEFILE,
"$doc_root/vccpmp3/cookies$ID.txt");
$buffer = curl_exec($curl_handle);
if (empty($buffer))
{
print "<p>Sorry, vcclite.com is not
responding.</p>";
}
else
{
fwrite($fp, $buffer);
// print $buffer;
}
curl_close($curl_handle);
fclose($fp);
}
Regards;
Tex McKloud
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2006-08-12