Jeg kan ikke få følgende til at fungere med krypterede sider:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>HEADERS</title>
<style type="text/css">
PRE{
border: 1px solid red;
}
</style>
</head>
<body>
<form action="headers.php" method="get">
<input type="text" name="url" style="width: 400px;" value="<?php echo $_GET['url'] ? $_GET['url'] :'tcp://www.php.net/'; ?>" />
<input type="submit" value="GO" />
</form>
<?php
$url = parse_url($_GET['url']);
$scheme = $url['scheme'] ? $url['scheme'].'://' : '';
$host = $url['host'];
$port = $url['port'] ? $url['port'] : 80;
$user = $url['user'];
$user = $url['pass'] ? $user.':'.$url['pass'] : $user;
$host = $user ? $user.'@'.$host : $host;
$path = $url['path'] ? $url['path'] : '/';
$path = $url['query'] ? $path.'?'.$url['query'] : $path;
$http_request = '';
if($path && $host){
echo "<h1>Connection to $scheme$host on port $port</h1>";
if($fp = fsockopen($scheme.$host, $port, $errno, $errstr, 10)){
echo '<p>Connected</p>';
$http_request .= "GET $path HTTP/1.1\\r\\n";
$http_request .= "Host: $host\\r\\n\\r\\n";
echo "<h1>Request for $_GET[url]</h1>";
echo '<pre>'.htmlentities($http_request).'</pre>';
if(fwrite($fp, $http_request)){
echo '<p>Requested</p>';
echo '<h1>Response</h1>';
echo '<pre>';
while (!feof($fp)){
echo htmlentities(fgets($fp, 128));
}
echo '</pre>';
echo '<p>Responded</p>';
fclose($fp);
}
else '<p>Write error</p>';
}
else{
echo "<p>Errno: $errno; Errstr: $errstr;</p>";
}
}
?>
</body>
</html>
Jeg får fejlen som ses:
http://dikrib.users.whitehat.dk/headers.php?url=ssl%3A%2F%2Fbugzilla.mozilla.org%2FHvorfor?