{"id":733,"date":"2010-04-26T22:38:00","date_gmt":"2010-04-26T13:38:00","guid":{"rendered":"http:\/\/www13.atpages.jp\/mattyan\/blog\/?p=733"},"modified":"2010-04-26T22:38:00","modified_gmt":"2010-04-26T13:38:00","slug":"php%e3%81%a7xml%e3%81%84%e3%82%8d%e3%81%84%e3%82%8d","status":"publish","type":"post","link":"https:\/\/mattyan.net\/blog\/?p=733","title":{"rendered":"PHP\u3067XML\u3044\u308d\u3044\u308d"},"content":{"rendered":"<p>Youtube\u306b\u52d5\u753b\u306e\u30e1\u30bf\u30c7\u30fc\u30bf\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u3068\u3001XML\u3067\u8fd4\u3057\u3066\u304f\u308b\u306e\u3067\u89e3\u6790\u4e2d\u3002<br \/>\n\u89e3\u6790\u306f&quot;$data=simplexml_load_file(&#8220;http:\/\/gdata.youtube.com\/feeds\/api\/videos\/&#8221;.$videoid);&quot;\u3067XML\u3092\u53d6\u5f97&#038;\u30d1\u30fc\u30b9\u3057\u3066\u5404\u7a2e\u8981\u7d20\u306b\u30a2\u30af\u30bb\u30b9\u3002<br \/>\n\u3067\u3001Youtube\u306e\u4e00\u90e8\u52d5\u753b\u306f\u5916\u90e8\u30d7\u30ec\u30fc\u30e4\u30fc\u3067\u518d\u751f\u3067\u304d\u306a\u3044\u3088\u3046\u306b\u306a\u3063\u3066\u308b\u304b\u3089\u3001\u305d\u308c\u306e\u5224\u5b9a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u305f\u3002<\/p>\n<pre style=\"border:solid #cccccc; background-color:#ffffff\"><code class=\"\" data-line=\"\">\n&lt;?xml version=&#039;1.0&#039; encoding=&#039;UTF-8&#039;?&gt;\n&lt;entry xmlns=&#039;http:\/\/www.w3.org\/2005\/Atom&#039; xmlns:app=&#039;http:\/\/purl.org\/atom\/app#&#039; xmlns:media=&#039;http:\/\/search.yahoo.com\/mrss\/&#039; xmlns:gd=&#039;http:\/\/schemas.google.com\/g\/2005&#039; xmlns:yt=&#039;http:\/\/gdata.youtube.com\/schemas\/2007&#039;&gt;\n\t&lt;id&gt;http:\/\/gdata.youtube.com\/feeds\/api\/videos\/GF69Om75cT4&lt;\/id&gt;\n\t&lt;published&gt;2008-10-24T16:30:40.000Z&lt;\/published&gt;\n\t&lt;updated&gt;2010-04-26T10:40:56.000Z&lt;\/updated&gt;\n\t&lt;app:control&gt;\n\t\t&lt;yt:state name=&#039;restricted&#039; reasonCode=&#039;limitedSyndication&#039;&gt;\n\t\t\tSyndication of this video was restricted by its owner.\n\t\t&lt;\/yt:state&gt;\n\t&lt;\/app:control&gt;\n\t&lt;category scheme=&#039;http:\/\/schemas.google.com\/g\/2005#kind&#039; term=&#039;http:\/\/gdata.youtube.com\/schemas\/2007#video&#039;\/&gt;\n\t&lt;category scheme=&#039;http:\/\/gdata.youtube.com\/schemas\/2007\/categories.cat&#039; term=&#039;Film&#039; label=&#039;\u6620\u753b\u3068\u30a2\u30cb\u30e1&#039;\/&gt;\n<\/code><\/pre>\n<p>\u5bfe\u8c61\u306e\u52d5\u753b\u306eXML\u306e\u4e00\u90e8\u3002<br \/>\n\u3067\u3053\u308c\u304c\u3001\u5358\u7d14\u306b\u8aad\u307f\u8fbc\u3093\u3060\u5834\u5408\u306e\u4e00\u90e8<\/p>\n<pre style=\"border:solid #cccccc; background-color:#ffffff\"><code class=\"\" data-line=\"\">SimpleXMLElement Object (\n\t[id] =&gt; http:\/\/gdata.youtube.com\/feeds\/api\/videos\/GF69Om75cT4\n\t[published] =&gt; 2008-10-24T16:30:40.000Z\n\t[updated] =&gt; 2010-04-26T10:40:56.000Z\n\t[category] =&gt; Array (\n\t\t[0] =&gt; SimpleXMLElement Object (\n\t\t\t[@attributes] =&gt; Array (\n\t\t\t\t[scheme] =&gt; http:\/\/schemas.google.com\/g\/2005#kind\n\t\t\t\t[term] =&gt; http:\/\/gdata.youtube.com\/schemas\/2007#video\n\t\t\t)\n\t\t)<\/code><\/pre>\n<p>\u9014\u4e2d\u3001&lt;app:control&gt;\u304c\u3054\u3063\u305d\u308a\u306a\u304f\u306a\u3063\u3066\u308b\u2026<br \/>\n\u30b0\u30b0\u3063\u3066\u307f\u308b\u3068\u3001XML\u306e\u30bf\u30b0\u540d\u306b:\u304c\u4ed8\u3044\u3066\u308b\u306e\u306f\u540d\u524d\u7a7a\u9593\u3089\u3057\u304f\u3001$app=$data->children(&#8220;app&#8221;,true);\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u307f\u305f\u3044\u3002<br \/>\n\u305f\u3060\u3001\u5916\u90e8\u30d7\u30ec\u30fc\u30e4\u30fc\u3067\u518d\u751f\u51fa\u6765\u308b\u52d5\u753b\u306b\u3053\u306e\u30bf\u30b0\u306f\u306a\u3044\u304b\u3089\u3001if(!empty($app))\u3067\u5224\u5b9a\u3057\u3066\u3084\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<br \/>\n\u3042\u3068\u3001@attributes\u4ee5\u4e0b\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u306b\u306f<\/p>\n<pre style=\"border:solid #cccccc; background-color:#ffffff\"><code class=\"\" data-line=\"\">$yt=$app-&gt;children(&quot;yt&quot;,true);$yt-&gt;state-&gt;attributes()-&gt;reasonCode==&quot;limitedSyndication&quot;<\/code><\/pre>\n<p>\u307f\u305f\u3044\u306a\u611f\u3058\u3067attributes\u95a2\u6570\u3092\u631f\u3093\u3067\u3084\u308b\u5fc5\u8981\u304c\u3042\u308b\u307f\u305f\u3044\u3002<br \/>\n\u9762\u5012\u304f\u3055\u3044\u306a\u3041&#8230;<br \/>\n\u8ffd\u8a18:XML\u306e\u6700\u5f8c\u306b&lt;yt:noembed\/&gt;\u304c\u3042\u308b\u306e\u3092\u78ba\u8a8d\u3002\u3069\u3063\u3061\u304b\u3063\u3066\u3044\u3046\u3068\u3001\u3053\u3044\u3064\u3092\u8a8d\u8b58\u3059\u308c\u3070\u3044\u3044\u306e\u304b?<br \/>\n<!--more--><br \/>\n\u3055\u3089\u306b\u9762\u5012\u304f\u3055\u3044\u3053\u3068\u3002<br \/>\nfirefox\u306fwindows\u7248\u3068Ubuntu\u7248\u3067&lt;input type=&quot;file&quot;&gt;\u306esize\u30d1\u30e9\u30e1\u30fc\u30bf\u6271\u3044\u304c\u9055\u3046\u307f\u305f\u3044\u3002\u5177\u4f53\u7684\u306b\u306f\u3001Windows\u7248\u306f\u30a8\u30c7\u30a3\u30bf\u3068\u53c2\u7167\u30dc\u30bf\u30f3\u307e\u3067\u3067\u4e00\u3064\u3068\u3057\u3066\u898b\u3066\u308b\u304b\u3089\u3001\u30a4\u30f3\u30dd\u30fc\u30c8\u30dc\u30bf\u30f3\u306e\u30b9\u30da\u30fc\u30b9\u304c\u7121\u3044\u5834\u5408\u3001\u4e0b\u306b\u305a\u308c\u8fbc\u3080\u3002Ubuntu\u7248\u306f\u5225\u3005\u306b\u898b\u3066\u308b\u3001\u3082\u3057\u304f\u306f\u898b\u65b9\u3092\u9593\u9055\u3048\u3066\u308b\u306e\u304b\u3001\u30a8\u30c7\u30a3\u30bf\u306e\u96a3\u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u30dc\u30bf\u30f3\u304c\u98df\u3044\u8fbc\u3080&#8230;(\u30b9\u30da\u30fc\u30b9\u81ea\u4f53\u306f\u3042\u308b\u304b\u3089\u4e0b\u306b\u305a\u308c\u8fbc\u307e\u306a\u3044)<br \/>\n<a href=\"http:\/\/cast-a-spell.at.webry.info\/200603\/article_6.html\"><br \/>\n\u305f\u307e\u306b\u306f\u546a\u6587\u3092\u3068\u306a\u3048\u3066\u307f\u308b\u304b\uff1a\u4ed5\u4e8b\u7248<\/a>\u3092\u53c2\u8003\u306b\u3001size\u3092\u8a08\u7b97\u3059\u308b\u95a2\u6570\u3092\u66f8\u3044\u3066\u5927\u4f53\u306e\u3068\u3053\u308d\u306f\u5408\u3046\u3088\u3046\u306b\u3057\u305f\u3002<br \/>\n\u306a\u3093\u3067\u3053\u3093\u306a\u4ed5\u69d8\u3057\u3066\u308b\u3093\u3060?<br \/>\n\u3042\u3068\u3064\u3044\u3067\u306b\u3001GoogleChrome\u3068Opera\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u52d5\u4f5c\u8a66\u9a13\u3057\u3066\u307f\u305f\u3002<br \/>\n\u7d50\u679c<\/p>\n<table border=\"1\" summary=\"result\">\n<tr>\n<td>\u30d6\u30e9\u30a6\u30b6<\/td>\n<td>\u7d50\u679c<\/td>\n<\/tr>\n<tr>\n<td>firefox3.6.3<\/td>\n<td>input file\u306e\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u4ee5\u5916\u4e0d\u5177\u5408\u306a\u3057\u3002<\/td>\n<\/tr>\n<tr>\n<td>Internet Exploere 8<\/td>\n<td>\u7279\u306b\u554f\u984c\u7121\u3057<\/td>\n<\/tr>\n<tr>\n<td>Google Chrome 4<\/td>\n<td>\u53f3\u30da\u30a4\u30f3\u304c\u3057\u305f\u306b\u305a\u308c\u308b<\/td>\n<\/tr>\n<tr>\n<td>Opera 10.51<\/td>\n<td>\u30d7\u30ec\u30a4\u30ea\u30b9\u30c8\u51fa\u529b\u6642\u306b\u3001\u62e1\u5f35\u5b50\u304cXML\u306b\u3055\u308c\u308b\u3002<br \/>\u30b7\u30e3\u30c3\u30d5\u30eb\u4e2d\u3001\u9805\u76ee\u304c\u79fb\u52d5\u3057\u3066\u308b\u306e\u304c\u898b\u3048\u308b&amp;\u9045\u3044\u3002(\u3044\u3061\u3044\u3061\u8868\u793a\u3057\u3066\u308b\u305b\u3044?)<\/td>\n<\/tr>\n<\/table>\n<p>\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u3063\u305f\u3002\u3068\u308a\u3042\u3048\u305a\u3001\u57fa\u672c\u6a5f\u80fd\u306b\u306f\u554f\u984c\u7121\u3057\u3002Safari\u3068\u304bSleipnir\u3068\u304b\u306f\u30a8\u30f3\u30b8\u30f3\u88ab\u3063\u3066\u308b\u3057\u3001\u305f\u3076\u3093\u5927\u4e08\u592b\u3060\u308d\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Youtube\u306b\u52d5\u753b\u306e\u30e1\u30bf\u30c7\u30fc\u30bf\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b\u3068\u3001XML\u3067\u8fd4\u3057\u3066\u304f\u308b\u306e\u3067\u89e3\u6790\u4e2d\u3002 \u89e3\u6790\u306f&quot;$data=simplexml_load_file(&#8220;http:\/\/gdata.youtube.com\/f &hellip; <a href=\"https:\/\/mattyan.net\/blog\/?p=733\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">PHP\u3067XML\u3044\u308d\u3044\u308d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,1],"tags":[],"class_list":["post-733","post","type-post","status-publish","format-standard","hentry","category-3","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=733"}],"version-history":[{"count":0,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/733\/revisions"}],"wp:attachment":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}