この記事は次のブログに引っ越しました。 https://blog.keinos.com/20100121_814PHPのfile_get_contents関数を使ってURL先のコンテンツを取得する際に、取得先にファイルがない(404エラーであった)場合の処理のサンプル・コードです。URLが存在するか調べるだけであれば、HTTPヘッダーを調べる方が軽いです。$sUrl = "http://your-url-to-check.com/"; //取得したいURL if( ( $sResponce = @file_get_contents($sUrl) ) == FALSE ){ // HTTPステータスコードを取得する list($version,$status_code,$msg) = explode(' ',$http_response_header[0], 3); // ステータスコードご