Parsing MochiAds feed in a friendly way
August 28, 2008 by Emanuele Feronato
Filed Under Php •
Filed Under Php •
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.
PHP:
-
<?php
-
-
$mochi_url = "http://www.mochiads.com/feeds/games?format=json";
-
$games_array = json_decode($feed, true);
-
-
-
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>: ";
-
echo "<ol>";
-
foreach($varvalue as $subvar => $subvalue){
-
echo "<li>";
-
foreach($subvalue as $lastvar => $lastvalue){
-
echo "$lastvalue";
-
if(!$lastvar){
-
echo ": ";
-
}
-
}
-
}
-
else{
-
echo "$subvalue";
-
}
-
echo "</li>";
-
}
-
echo "</ol>";
-
}
-
else{
-
echo "<a href = \"$varvalue\" target = \"_blank\">$varvalue</a>";
-
}
-
else{
-
echo $varvalue;
-
}
-
}
-
echo "</li>";
-
}
-
echo "</ul></li>";
-
}
-
echo "</ol>";
-
-
?>
Hope you will find it useful.
Improve the blog rating this post
Tell me what do you think about this post. I'll write better and better entries.
Tell me what do you think about this post. I'll write better and better entries.
7 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 [...]


(2 votes, average: 3.5 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!