问题已经解决~:)
贴出来大家参考~!!
<?
$filename="http://www.csdn.net/";
$fp=@fopen($filename,"r");
$body=@fread($fp,$);
if (strlen($body)<0){
echo "no math!";
}else{
echo $body;
}
@fclose();
?>
贴出来大家参考~!!
<?
$filename="http://www.csdn.net/";
$fp=@fopen($filename,"r");
$body=@fread($fp,$);
if (strlen($body)<0){
echo "no math!";
}else{
echo $body;
}
@fclose();
?>
$body=@fread($fp,$);
if (strlen($body)<0){
这两句都不对,而且echo $body; 什么也没有!
$theaddr = "www.csdn.net";
error_reporting (E_ALL);
$service_port = getservbyname('www', 'tcp');
$address = gethostbyname ($theaddr);
$socket = socket_create(AF_INET, SOCK_STREAM, 0);$result = socket_connect($socket, $address, $service_port);
if ($result < 0) {
$the_info = "socket_connect() failed.\nReason: ($result) " . socket_strerror($result) . "\n";
} else {
$the_info = "OK.\n";
}
if (isset($_GET['info'])) {
echo $the_info."<br>";
}
$in = "GET / HTTP/1.0\r\nHost: $theaddr\r\n\r\n";
$out = '';
$the_contect = '';
socket_write ($socket, $in, strlen ($in));for ($i = 0; $i < 100; $i++) {
$out = socket_read($socket,2048);
$the_contect .= $out;
}echo "<textarea name=me rows=40 cols=120>$the_contect</textarea>";socket_close ($socket);
?>