<?php
$yoursite ="http://website.com"
$name = "name";
$password = "password";
$string=base64_encode($name.":".$password);
$head="GET / HTTP/1.0\r\n\r\n";
$head.="Accept: text/html\r\n";
$head.="Authorization: Basic $string\r\n\r\n";
$fp =fsockopen($yoursite, 80, $errno, $errstr, 30);
if (!$fp) {echo "$errstr ($errno)";
}
else
{
fwrite ($fp, $head);
while (!feof($fp)) echo fgets ($fp,128);
}
fclose ($fp);
?>
沒有留言:
張貼留言