Getting and Printing a Web Page with fopen() : Socket « Network « PHP






Getting and Printing a Web Page with fopen()

<html>
<head>
<title>Getting and printing a web page with fopen()</title>
</head>
<body>
<?php
$webpage = "http://www.java2s.com/index.htm";
$fp = fopen( $webpage, "r" ) or die("couldn't open $webpage");
while ( ! feof( $fp )){
    print fgets( $fp, 1024 );
}
?>
</body>
 </html>

           
       








Related examples in the same category

1.Open socket and read
2.Outputting the Status Lines Returned by Web Servers
3.Retrieving a Web Page Using fsockopen()