課題4:HTTPクライアントの作成


ソケットおよびHTMLを使ってWWWサーバから任意のURLのページを取得し、標準出力に出力するプログラムを作成せよ。

httpget.cのソース

【実行結果】


st-NEET:~/report/jikken/nagata j05043$ ./httpget mixi.jp 
HTTP/1.1 400 Bad Request
Date: Mon, 18 Dec 2006 04:33:56 GMT
Server: Apache
Content-Length: 226
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
</body></html>