Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Does itch.io support PHP ?

A topic by BrookyTest created Nov 26, 2019 Views: 1,198 Replies: 6
Viewing posts 1 to 3

In my UNIT game, I use a PHP script to record user results. Does itch.io support the execution of PHP?

I don't think you can include PHP in the files you upload to Itch.io, but your game could call an API that you host yourself. If you give some more details about how your game works and where the PHP comes into play I could elaborate further.

(1 edit)

William, grateful for any idea!
Leo.

iIndex.php?data=UserLeonFinishedScene1 

iIndex.php :

<?php
  echo 'I will write UserData to user.log <br />'; 
  $filename = 'user.log';
  $text = "\r\n Date:". date('Y-m-d\=H:i:s') . "Data :" . $_GET["data"];
    //Writing: 
  $file = fopen ($filename, "a");
  fwrite ($file,$text);
  fclose ($file);
  echo "UserData was writed successfull to file [$filename]  !<br/><br/>"; 
?>

Basically what you should do is host your PHP file on your own web server, then have your game make a GET request to

https://[your domain name]/iIndex.php?data=UserLeonFinishedScene1

So when someone plays your game on here, their browser downloads all the actual game stuff from Itch, but those game files then tell it to send some data to your server. If you already have the game working on your own website then you should be able to basically just upload the same client files to Itch, although you might have to set up CORS headers on your sever or something.

"Basically what you should do is host your PHP file on your own web server...."  It is possible. But, "on my own web server" I can host the game itself. But why then do I need ITCH.IO? For monetization only?

But why then do I need ITCH.IO?

I mean, you don't. Itch is (from my understanding) mainly designed as a marketplace for games. They host free stuff too because they're cool like that, but they're not really a replacement for a web host. If you're looking for someone to rent you a PHP server this isn't the place for that.

Admin

We don’t execute a server side-code for you. For HTML5 games we only support what can run directly in the viewer’s browser. If you need server-side code you’re responsible for hosting it yourself, but you can communicate directly with it from your HTML5 game.

Thanks

This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.