{"id":857,"date":"2011-06-06T04:04:50","date_gmt":"2011-06-05T19:04:50","guid":{"rendered":"http:\/\/blog.t-szk.com\/?p=857"},"modified":"2011-06-06T04:04:50","modified_gmt":"2011-06-05T19:04:50","slug":"php%e3%83%aa%e3%82%af%e3%82%a8%e3%82%b9%e3%83%88%e5%85%88%e3%81%aeurl%e3%81%8c%e5%ad%98%e5%9c%a8%e3%81%97%e3%81%aa%e3%81%8b%e3%81%a3%e3%81%9f%e5%a0%b4%e5%90%88%e3%81%ae%e5%87%a6%e7%90%86%e6%96%b9","status":"publish","type":"post","link":"https:\/\/codaholic.org\/?p=857","title":{"rendered":"[PHP]\u30ea\u30af\u30a8\u30b9\u30c8\u5148\u306eURL\u304c\u5b58\u5728\u3057\u306a\u304b\u3063\u305f\u5834\u5408\u306e\u51e6\u7406\u65b9\u6cd5"},"content":{"rendered":"<p>file_get_contents\u95a2\u6570\u7b49\u3067HTML\u3092\u53d6\u5f97\u3059\u308b\u3068\u304d\u3084\u3001API\u3092\u5229\u7528\u3059\u308b\u305f\u3081\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3059\u308b\u3068\u304d\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u5148\u306eURL\u304c\u5b58\u5728\u3057\u306a\u3044\u3082\u306e\u3060\u3063\u305f\u5834\u5408\u3001\u30a8\u30e9\u30fc\u3068\u306a\u308a\u6b63\u5e38\u306a\u51e6\u7406\u304c\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u30a8\u30e9\u30fc\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u505c\u6b62\u3057\u3066\u3057\u307e\u3046\u306e\u306f\u56f0\u308a\u307e\u3059\u306e\u3067\u30a8\u30e9\u30fc\u306e\u6642\u306b\u51e6\u7406\u3092\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u65b9\u6cd5\u3092\u8003\u3048\u307e\u3059\u3002<\/p>\n<p><!--more--><br \/>\n\u4e0b\u8a18\u306e\u30b3\u30fc\u30c9\u306f\u3001\u5b58\u5728\u3057\u306a\u3044URL\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u51fa\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>[php]<br \/>\n<?php\n\t$html = file_get_contents('http:\/\/t-szk.com\/hoge.html');\n?><br \/>\n[\/php]<\/p>\n<p>\u5b9f\u884c\u7d50\u679c\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306aWarning\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>Warning: file_get_contents(http:\/\/t-szk.com\/hoge.html) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP\/1.1 404 Not Found in \/var\/www\/vhosts\/t-szk.com\/httpdocs\/lab\/header\/index.php on line 2<\/p>\n<p>\u3053\u306e\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u6291\u5236\u3059\u308b\u305f\u3081\u306b\u30a8\u30e9\u30fc\u5236\u5fa1\u6f14\u7b97\u5b50\u300c@\u300d\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>[php]<br \/>\n<?php\n\t$html = @file_get_contents('http:\/\/t-szk.com\/hoge.html');\n?><br \/>\n[\/php]<\/p>\n<p>\u30a8\u30e9\u30fc\u5236\u5fa1\u6f14\u7b97\u5b50\u3092\u4f7f\u3046\u3053\u3068\u3067\u30a8\u30e9\u30fc\u306e\u8868\u793a\u306f\u6291\u5236\u3055\u308c\u307e\u3059\u304c\u3001\u30a8\u30e9\u30fc\u3060\u3063\u305f\u6642\u306e\u305f\u3081\u306e\u51e6\u7406\u3092\u8ffd\u52a0\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u884c\u3063\u305f\u6642\u306e\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u306b\u5fdc\u3058\u3066\u51e6\u7406\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u5b9a\u7fa9\u6e08\u307f\u5909\u6570\u306e$http_response_header\u3092\u53c2\u7167\u3057\u307e\u3059\u3002$http_response_header\u306f\u914d\u5217\u306b\u306a\u3063\u3066\u304a\u308a\u3001\u8981\u7d20\u756a\u53f70\u306e\u4e2d\u306b\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u305d\u306e\u4e2d\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u3092\u898b\u3066\u51e6\u7406\u3092\u5206\u5c90\u3055\u305b\u307e\u3059\u3002<\/p>\n<p>[php]<br \/>\n<?php\n\t$html = @file_get_contents('http:\/\/t-szk.com\/hoge.html');\n\t\n\tif($http_response_header[0] == 'HTTP\/1.1 404 Not Found'){\n\t\tprint '404 Not Found\u3067\u3059\u3002';\n\t}\n?><br \/>\n[\/php]<\/p>\n<p>\u30a8\u30e9\u30fc\u5236\u5fa1\u6f14\u7b97\u5b50\u3068$http_response_header\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u30b9\u30c6\u30fc\u30bf\u30b9\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u9001\u4fe1\u3059\u308b\u30ea\u30af\u30a8\u30b9\u30c8\u30921\u5ea6\u306b\u6291\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>file_get_contents\u95a2\u6570\u7b49\u3067HTML\u3092\u53d6\u5f97\u3059\u308b\u3068\u304d\u3084\u3001API\u3092\u5229\u7528\u3059\u308b\u305f\u3081\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\u3059\u308b\u3068\u304d\u306b\u30ea\u30af\u30a8\u30b9\u30c8\u5148\u306eURL\u304c\u5b58\u5728\u3057\u306a\u3044\u3082\u306e\u3060\u3063\u305f\u5834\u5408\u3001\u30a8\u30e9\u30fc\u3068\u306a\u308a\u6b63\u5e38\u306a\u51e6\u7406\u304c\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u30a8\u30e9\u30fc\u3067\u30d7\u30ed\u30b0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[4],"tags":[154,155],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8gd1W-dP","_links":{"self":[{"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/posts\/857"}],"collection":[{"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codaholic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=857"}],"version-history":[{"count":4,"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/posts\/857\/revisions"}],"predecessor-version":[{"id":866,"href":"https:\/\/codaholic.org\/index.php?rest_route=\/wp\/v2\/posts\/857\/revisions\/866"}],"wp:attachment":[{"href":"https:\/\/codaholic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codaholic.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codaholic.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}