{"id":12612,"date":"2019-01-15T18:05:19","date_gmt":"2019-01-15T09:05:19","guid":{"rendered":"https:\/\/nxpg.net\/blog\/?p=12612"},"modified":"2019-06-11T16:33:35","modified_gmt":"2019-06-11T07:33:35","slug":"%e8%a1%a8%e7%8f%be%e3%81%ae%e5%b9%85%e3%82%92%e5%ba%83%e3%81%92%e3%82%88%e3%81%86%ef%bc%81%e3%80%80%e3%80%9csvg%e7%b7%a8%e3%80%9c","status":"publish","type":"post","link":"https:\/\/nxpg.net\/blog\/tech\/?p=12612","title":{"rendered":"\u3010YQL\u7d42\u4e86\u5bfe\u5fdc\u3011 \u30af\u30ed\u30b9\u30c9\u30e1\u30a4\u30f3\u3067xml\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\u3057\u305f\u3044\u3002"},"content":{"rendered":"<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-12686 size-full\" src=\"https:\/\/nxpg.net\/blog\/wp-content\/uploads\/2019\/01\/r2_c2.png\" alt=\"\u30af\u30ed\u30b9\u30c9\u30e1\u30a4\u30f3\u3067xml\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\u3057\u305f\u3044\" width=\"720\" height=\"480\"><\/p>\n<p>\u897f\u5ddd\u3067\u3059\u3002<br \/>\n\u30af\u30ed\u30b9\u30c9\u30e1\u30a4\u30f3\u3067ajax\u901a\u4fe1\u3059\u308b\u305f\u3081\u306b\u3001\u4eca\u307e\u3067\u306fxdomainajax.js\u3092\u4f7f\u7528\u3002<br \/>\n\u304c\u3001\u5e74\u660e\u3051\u306b\u30b5\u30a4\u30c8\u3092\u898b\u3066\u307f\u308b\u3068\u3001\u3053\u3093\u306a\u30a8\u30e9\u30fc\u304c\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u308b\uff01<\/p>\n<blockquote><p>Failed to load resource: net::ERR_NAME_NOT_RESOLVED<\/p><\/blockquote>\n<p>\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u4f7f\u7528\u3055\u308c\u3066\u3044\u305fYQL\uff08Yahoo Query Language\uff09\u304c2019\/1\/3\u306b\u30b5\u30fc\u30d3\u30b9\u7d42\u4e86\u3057\u3066\u3057\u307e\u3063\u305f\u3088\u3046\u3067\u3059&#8230;<br \/>\n\uff08\u300cYQL\u306f\u3001\u7c73Yahoo! Developer Network\u304c\u63d0\u4f9b\u3057\u3066\u3044\u308b\u3001\u3042\u308a\u3068\u3042\u3089\u3086\u308bWeb\u4e0a\u306e\u30ea\u30bd\u30fc\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u30b5\u30fc\u30d3\u30b9\u300d\u3067\u3057\u305f\u3002\u30c9\u30e1\u30a4\u30f3\u3082\u524a\u9664\u3055\u308c\u3066\u3044\u308b&#8230;XML\u3082JSON\u306b\u5909\u63db\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u4fbf\u5229\u3060\u3063\u305f\u306e\u306b&#8230;\uff09<br \/>\n<a href=\"https:\/\/developer.yahoo.com\/yql\/\">https:\/\/developer.yahoo.com\/yql\/<\/a><\/p>\n<p>\u6025\u304e\u3067\u5bfe\u5fdc\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u3044\u304f\u3064\u304b\u8abf\u3079\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h2>\u30af\u30ed\u30b9\u30c9\u30e1\u30a4\u30f3\u3067ajax\u901a\u4fe1\u3059\u308b\u65b9\u6cd5<\/h2>\n<ol>\n<li>xdomainajax.js<\/li>\n<li>JSONP<\/li>\n<li>php\u3092\u4f7f\u7528\u3057\u3066\u5b9f\u73fe<\/li>\n<\/ol>\n<h2>\u4eca\u56de\u306e\u554f\u984c<\/h2>\n<p>\uff081\uff09\u306f\u4eca\u56de\u304b\u3089\u4f7f\u3048\u306a\u304f\u306a\u3063\u305f\u306e\u3067\u3001\u9664\u5916\u3002YQL\u306e\u4ee3\u66ff\u30b5\u30a4\u30c8\u3092\u63a2\u3059\u6642\u9593\u306f\u306a\u3044&#8230;<br \/>\n\u307e\u305f\u3001\u51fa\u529b\u5074\u306e\u30c7\u30fc\u30bf\u3092\u4fee\u6b63\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044\u306e\u3067\uff082\uff09\u306e\u65b9\u6cd5\u306f\u4eca\u56de\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306f\uff083\uff09\u3067\u5bfe\u5fdc\u3057\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u53c2\u8003\u8a18\u4e8b\u306f\u4ee5\u4e0b\u3067\u3059\u3002<\/p>\n<p>\u53c2\u8003<br \/>\n<a href=\"https:\/\/qiita.com\/tsunet111\/items\/c1a4ce1499e53fce449a\">https:\/\/qiita.com\/tsunet111\/items\/c1a4ce1499e53fce449a<\/a><\/p>\n<div><\/div>\n<h2>\u7528\u610f\u3057\u305f\u3082\u306e<\/h2>\n<p>php\u3067xml\u3092\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3067\u53d6\u5f97\u3057\u3066\u3001js\u3067xml\u306b\u5909\u63db\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<h4>ajax.php<\/h4>\n<pre><code>\n    &lt;?php\n        if(isset($_GET[\"url\"]) &amp;&amp; preg_match(\"\/^https?:\/\",$_GET[\"url\"])){\n        echo file_get_contents($_GET[\"url\"]);\n    }else{\n        echo \"error\";\n    }\n<\/code><\/pre>\n<h4>function.js<\/h4>\n<pre><code>\n   var xurl = encodeURIComponent('\u53d6\u5f97\u3057\u305f\u3044xml\u306eurl');\n    \n    $.ajax({\n        url: \"ajax.php?url=\"+xurl,\n        dataType: 'text',\n        type: \"GET\",\n        success: function(res) {\n            var xmlText = res,\n                xmlDoc = $.parseXML(xmlText);\n            console.log(res);\n        }\n    })\n<\/code><\/pre>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3042\u307e\u308a\u5f97\u610f\u3058\u3083\u306a\u3044\u306e\u3067\u3001\u3044\u3064\u3082js\u3067\u306a\u3093\u3068\u304b\u3057\u3088\u3046\u3068\u3057\u3066\u307e\u3057\u305f\u304c\u3001<br \/>\n\u3061\u3087\u3063\u3068\u8abf\u3079\u3066\u307f\u308c\u3070\u3001js\u3067\u66f8\u304f\u3088\u308a\u3082\u7c21\u5358\u306b\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u5e74\u306fphp\u3084python\u3092\u52c9\u5f37\u3057\u3066\u3044\u304d\u305f\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u897f\u5ddd\u3067\u3059\u3002 \u30af\u30ed\u30b9\u30c9\u30e1\u30a4\u30f3\u3067ajax\u901a\u4fe1\u3059\u308b\u305f\u3081\u306b\u3001\u4eca\u307e\u3067\u306fxdomainajax.js\u3092\u4f7f\u7528\u3002 \u304c\u3001\u5e74\u660e\u3051\u306b\u30b5\u30a4\u30c8\u3092\u898b\u3066\u307f\u308b\u3068\u3001\u3053\u3093\u306a\u30a8\u30e9\u30fc\u304c\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u308b\uff01 Failed to load resource [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":12998,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[7],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=\/wp\/v2\/posts\/12612"}],"collection":[{"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12612"}],"version-history":[{"count":1,"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=\/wp\/v2\/posts\/12612\/revisions"}],"predecessor-version":[{"id":12999,"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=\/wp\/v2\/posts\/12612\/revisions\/12999"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=\/wp\/v2\/media\/12998"}],"wp:attachment":[{"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nxpg.net\/blog\/tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}