{"id":19522,"date":"2016-02-25T03:01:44","date_gmt":"2016-02-24T17:01:44","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=19522"},"modified":"2016-02-24T19:57:42","modified_gmt":"2016-02-24T09:57:42","slug":"php-city-guess-country-game-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-primer-tutorial\/","title":{"rendered":"PHP City Guess Country Game Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"PHP City Guess Country Game Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.jpg\" title=\"PHP City Guess Country Game Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">PHP City Guess Country Game Primer Tutorial<\/p><\/div>\n<p>There is no end to the variety of web applications you can do by seeing what free information is out there, but please don&#8217;t disrepect the sources of that information.  The source for our information today is the excellent XML files created at <a target=_blank title='http:\/\/www.webserviceX.NET' href='http:\/\/www.webserviceX.NET'>Webservices<\/a> &#8230; so &#8230; thanks.<\/p>\n<p>Today&#8217;s game is deceptively simple but quite dynamic, in the sense that we set aside a web server directory for our game today that we have called &#8220;City Guess Country Game&#8221; and whatever subset of XML files you have from <a target=_blank title='http:\/\/www.webserviceX.NET' href='http:\/\/www.webserviceX.NET'>http:\/\/www.webservicex.net\/new\/Home\/Index<\/a> are dynamically read to be the source of information.  Here, for the next level up of dynamism you&#8217;d involve an RSS feed perhaps, but, today, we just talk about using what we statically have &#8220;plonked&#8221; in our directory set aside for the game.  The word &#8220;plonked&#8221; always makes me associate with the ever useful PHP method called <a target=_blank title='PHP glob method information' href='http:\/\/php.net\/manual\/en\/function.glob.php'><i>glob<\/i><\/a> &#8230; yes &#8230; glob &#8230; and so it is here, because that &#8220;globbing&#8221; definitely goes on.  What you will perhaps be disappointed with today is that we don&#8217;t use PHP XML native functionality to process the XML data, and please know we recommend trying these approaches as you see fit, but we find the PHP <a target=_blank href='http:\/\/php.net\/manual\/en\/function.explode.php' title='PHP explode method information'><i>explode<\/i><\/a> method relatively easy to deploy for scenarios like this where the data form is so predictable, and simple.<\/p>\n<p>Deceptively simple games can sometimes be the best, and find that that interest, or not, relates to what we are interested in ourselves &#8230; for me that, in particular, is atlases, geography, the &#8220;where&#8221; of life &#8230; so today&#8217;s game interests me as much as it will bore others (no doubt).<\/p>\n<p>We show you PHP source code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php_GETME\" title=\"city_guess.php\">city_guess.php<\/a> and a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Games\/CityGuessCountry\/city_guess.php\" title='Click picture'>live run<\/a> link as well.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d19522' onclick='var dv=document.getElementById(\"d19522\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/games\/\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d19522' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>There is no end to the variety of web applications you can do by seeing what free information is out there, but please don&#8217;t disrepect the sources of that information. The source for our information today is the excellent XML &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-city-guess-country-game-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/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":[12,15,37],"tags":[1781,932,997,1319,1412,1480],"class_list":["post-19522","post","type-post","status-publish","format-standard","hentry","category-elearning","category-games","category-tutorials","tag-game-games","tag-php","tag-programming","tag-tutorial","tag-web-service","tag-xml"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/19522"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=19522"}],"version-history":[{"count":3,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/19522\/revisions"}],"predecessor-version":[{"id":19525,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/19522\/revisions\/19525"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=19522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=19522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=19522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}