Parsing MochiAds feed in a friendly way
I made this little script to debug my portal script (almost completed) and I want to share it with you.
It simply shows MochiAds feed in a friendly way, using lists.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | <?php $mochi_url = "http://www.mochiads.com/feeds/games?format=json"; $feed = file_get_contents($mochi_url); $games_array = json_decode($feed, true); $number_of_games = count($games_array[games]); echo "<ol>"; for($x=0;$x<$number_of_games;$x++){ echo "<li><ul>"; foreach($games_array[games][$x] as $varname => $varvalue) { echo "<li><strong>$varname</strong>: "; if(is_array($varvalue)){ echo "<ol>"; foreach($varvalue as $subvar => $subvalue){ echo "<li>"; if(is_array($subvalue)){ foreach($subvalue as $lastvar => $lastvalue){ echo "$lastvalue"; if(!$lastvar){ echo ": "; } } } else{ echo "$subvalue"; } echo "</li>"; } echo "</ol>"; } else{ if(strpos($varvalue,"http")!==false){ echo "<a href = \"$varvalue\" target = \"_blank\">$varvalue</a>"; } else{ echo $varvalue; } } echo "</li>"; } echo "</ul></li>"; } echo "</ol>"; ?> |
Hope you will find it useful.
9 Responses to “Parsing MochiAds feed in a friendly way”
Leave a Reply
Trackbacks
-
10 tips help you choosing the right hosting plan for your blog/arcade site : Emanuele Feronato on
August 31st, 2008 10:20 pm
[...] hosting plan can handle enough work, you should at least be able to run the script published in Parsing MochiAds feed in a friendly way or you won’t be able to have your WordPress arcade [...]
- Get up to $100,000 for your next Flash game with Mochi GAME Developer Fund
- Create a dynamic content animated footer ad for your site in just 9 jQuery lines – 17 lines version
- Sell sitelocked version of your Flash games and even .fla sources to Free Online Games
- Protect your work from ActionScript code theft with SWF Protector
- Create a dynamic content animated footer ad for your site in just 9 jQuery lines
- Understanding Box2D’s one-way platforms, aka CLOUDS
- Triqui MochiAds Arcade plugin for WordPress upgraded to 1.2
- Box2D Flash game creation tutorial – part 2
- 11 Flash isometric engines you can use in your games
- Monetize your Flash games with GamesChart
- Create a Lightbox effect only with CSS - no javascript needed
- Flash game creation tutorial - part 1
- Create a Flash Racing Game Tutorial
- Flash game creation tutorial - part 2
- Make a Flash game like Flash Element Tower Defense - Part 2
- Flash game creation tutorial - part 3
- Make a Flash game like Flash Element Tower Defense - Part 1
- Create a flash draw game like Line Rider or others - part 1
- Triqui MochiAds Arcade plugin for WordPress official page
- Create a flash artillery game - step 1
- Flash game creation tutorial – part 5.2 (4.88/5)
- Create a flash artillery game – step 1 (4.79/5)
- Create a Flash Racing Game Tutorial (4.76/5)
- Create a flash artillery game – step 2 (4.74/5)
- Create a survival horror game in Flash tutorial – part 1 (4.73/5)
- Creation of a Flash arcade site using WordPress – step 2 (4.73/5)
- Flash game creation tutorial – part 2 (4.71/5)
- Flash game creation tutorial – part 1 (4.70/5)
- Create a flash draw game like Line Rider or others – part 1 (4.69/5)
- Creation of a platform game with Flash – step 2 (4.68/5)


(2 votes, average: 3.50 out of 5)





When I run the page I get a undifined function call at line 5.
That’s because your hosting server does not support Php 5.2
What if we get a memory error?
cheap server…
Wow Emanuele, you know so many languages O_o
nice for testing, thanks!
Another solution :)
<img src="” alt=”"/>
<a href="page_detail.php?game_name=”>
Controls:
Tag:
Game_id:
I was just starting to work on something like this….It looks good.