<form method="POST" action="1.php">
<textarea name="url" rows="10" cols="50"></textarea>
<br>
<input type="submit" vakue="Submit">
<input type="reset" vakue="Reset">
</form>
<?
foreach ((array)explode("\n", $_POST['url']) as $string)
{
$handle = fopen($string, "r");
$contents = fread($handle, 256);
fclose($handle);
$startpos = strpos($contents, '<title>')+7;
$endpos = strpos($contents, '</title>');
echo htmlspecialchars(substr($contents, $startpos, $endpos-$startpos));
echo "<br>";
}
?>
проверяю
http://forum.sources.ru - всё нормально
а вот если
http://forum.sources.ru
http://google.ru
Warning: fopen() [function.fopen]: couldn't resolve host name in /usr/home/wa201cb/public_html/1.php on line 7
Warning: fopen(
http://forum.sources.ru ) [function.fopen]: failed to open stream: Invalid argument in /usr/home/wa201cb/public_html/1.php on line 7
Warning: fread(): supplied argument is not a valid stream resource in /usr/home/wa201cb/public_html/1.php on line 8
Google