Integrate Mochi games in your custom arcade website
Do you want to create your custom arcade website without using popular arcade scripts or WordPress plugins? Maybe with a Mochi integration?
That’s what Gabriel Bianconi did, and he wants to share his script with us.
It’s a simple, interesting script dedicated to all developers looking for a quick way to integrate Mochi games into their custom arcade sites.
« Hello. My name is Gabriel Bianconi. I’m a 16 years old Brazilian student and I’m interested in game and web development.
I’ve recently launched my first arcade website, PlugB.com. I decided to create my own script for two reasons: to improve my PHP skills and to have a more customizable website.
One of the features I integrated to my admin was the MochiAds ‘Post Game to my Site’ button. Since I add games manually (I don’t want to import all Mochi games), this saves me a lot of time.
When I tried to search about this feature, I realized that there is no tutorial about this online (at least, I couldn’t find one). I searched a little more and found a few scripts about this.
They were integrated to some arcade scripts, so I couldn’t just copy and paste them. But it was a start.
The script that I most used was from Timothy E. Archer.
After a few tests, I’ve created a working script:
Firstly, you’ll need a MochiAds publisher account.
After registering and adding your website, go to the Settings page.
In the bottom of the page, below ‘Auto Post Settings’, set the ‘Auto Post Method’ to ‘Custom built script’ and the ‘Auto Post URL’ to the URL of your script.
Now the PHP part:
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 | <?php $game_tag = $_POST['game_tag']; // Sample tag to fake a mochi request... Remove this line in final version... $game_tag = 'cd698a06f727e887'; if(!$game_tag) { die('No gametag.'); } // This can be found in the settings page. $mochi_pub_id = 'xxxxxxxxxxxxxxxxxxxxx'; $game_feed_url = "http://www.mochiads.com/feeds/games/$mochi_pub_id/$game_tag/?format=json"; //Retrieves and parses the JSON data of the game. $json_feed = file_get_contents($game_feed_url); $json_items = json_decode($json_feed, TRUE); $game = $json_items['games'][0]; /* Now you can access all variables about the game with $game['variable_name']; * For example: $game['name'] or $game['swf_url'] * The full list of the variables can be found here: https://www.mochimedia.com/support/pub_docs#feed_3 * I did not add how to save in a database because it changes from script to script. */ // Sample: (can be removed in final version) echo $game['name'] . ' - ' . $game['swf_url']; /* You should get: Sokobones - http://games.mochiads.com/c/g/sokobones_v1/Sokobones-MochiAds_Secure.swf * if you used the sample tag. * Remove that line in the final version. */ ?> |
Remember to remove the sample game tag in the final version.
Thank you for reading the tutorial. I hope this helps you. Please let me know what you think about this and visit my arcade website. »















(10 votes, average: 4.60 out of 5)









This post has 19 comments
Gabriel Bianconi
Thank you for publishing my tutorial!
Andi
You can find the complete code for wordpress integration and some explanations here: http://blog.creative-webdesign.info/2010/05/29/autopost-mochiads-games-in-your-wordpress-arcade-website.html
HoodaMath
Looking forward to trying it. Out.
Vega
thx Gabriel for this very usefull snippet and ofc Emanuele for posting it :)
Now i just need to implement some quality-threshold to decide which games i can “ignore”. *thinking*
Azarai
The integration with mochiads is easy , the hard part is running the site successfully :-)
btw i did code an arcade site with python some time ago, maybe it useful for your readers
http://codeboje.de/flash-game-portal-python/
Integrate Mochi games in your custom arcade website | Scot Trodick's blog
[...] http://www.emanueleferonato.com/2010/05/21/integrate-mochi-games-in-your-custom-arcade-website/ [...]
Gil Amran
Hi,
I know that it’s not totally related, but I didn’t find other way to contact you…
My question is very simple:
I’m a AS3/Flash developer with a very long background in programming, and I thought about moving into the Android arena…. I’ve read many of your posts, and it seems that you know what you’re doing.
On one of your posts you mentioned that in Italy a developer get ~$44 per hour. and you wanted to a get a game to give you $123 per hour… you didn’t say if it worked…
so the question is, does it worth it? is the money good?
Thanks
Gil
Integrate Mochi games in your custom arcade website | Team iDesign
[...] http://www.emanueleferonato.com/2010/05/21/integrate-mochi-games-in-your-custom-arcade-website/ SHARETHIS.addEntry({ title: "Integrate Mochi games in your custom arcade website", url: "http://www.teamidesign.com/?p=28" }); [...]
jorge
Hello, this looks very useful, i´ve been looking for something like this for some time, i have a handpicked game site and i want to integrate it with mochi, but im kind of a noob, i dont have the slightest idea where to paste that code above and i cant find any support or more documentation, can anyone help out, please?
ricky sanchez
Is a mochaid account free?
DieselMu
yes mochiads is free !
connor smith
this looks great, super simple. I’ll try it out later tonight
colloidal silver
Seriously great! Kudos for taking the time so that you can really post consistently. I’ve been trying to as significantly as I can, but it is so difficult to get into a rhythm with blogging and site-building.
Christian Robertson
Good one. I look forward to see more.
Latest Phone reviews
awesome, Gabriel Bianconi still 16 years old and he did a great job. thanks for script child
Scott Allen
Hello, I would very much like to install mochigames on my site. I’ve been told more than once that mochigames will not work on my e107 website, but I refuse to believe it. Will this script allow me to accomplish my goal and if so would you help me install it?
Thank you very much.
utility warehouse
but how to install it
?
Noob
Please little more help, full/ tutorial for newbies like me. Where this file goes, what i need to do , i am confused. Please ???????????
???????????????????
Thanks for good tutorial