Forum Moderators: coopster
"Snoopy is a PHP class that simulates a web browser. It automates the task of retrieving web page content and posting forms, for example."
I just see a short part of the web page as a result of this php-script. How do I get the whole page?
Is it also possible to get the html code from this page?
<?php
$fp = fopen("http://mysite.com", "r");
$data = fread($fp, 1024*1024);
fclose($fp);
header("Content-type: text/plain");
echo $data;
?>
<?php
// Get a file into an array. In this example we'll go through HTTP to get
// the HTML source of a URL.
$lines = file ('http://www.example.com/');// Loop through our array, show html source as html source; and line numbers too.
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n";
}
// Another example, let's get a web page into a string. See also file_get_contents().
$html = implode ('', file ('http://www.example.com/'));
?>
from: [hu.php.net...]
$string = ' string722 abcd abc123def456 789 ';
preg_match_all("/([[:alpha:]]\w*\d+\b)/", $string, $matches);
for ($i=0; $i<count($matches[1]); $i++) {
print $matches[1][$i].'<br />';
}
// prints:
// string722
// abc123def456