Network Behaviors
VodkaNale
Member Posts: 8
Hi, can someone explain me how can i make the Network Send Table to url working?
I want to try it on localhost. Do i have to edit Hosts file or smh? Thanks
Answers
http://forums.gamesalad.com/discussion/63636/sending-and-receiving-data-using-your-own-sql-server-php-file-and-testproject-included/p1
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I can't use his project, i'm on Mac. I already done everything but i don't understand Step 5: Configure PHP
We are going to be copying the template PHP file into /Applications/MAMP/bin/mamp/.
Did you create the file? Did you find the folder /Applications/MAMP/bin/mamp/ ?
You need to download the file from https://dl.dropboxusercontent.com/u/5068448/support/asyncTest.php and place it in that folder.
@Manto what link i type in Get table from url?
localhost:8888/???
If I remember correctly it should be http://localhost:8888/MAMP/asyncTest.php
that's my project and it was developed on a mac
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
so to answer your question, Inside your applications folder there will be a MAMP folder, inside that you browse to bin -> MAMP and drop the template file in there
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
http://bitspoofdb.epizy.com/get.php here's the php file working but when i use the behavior to get the table it shows me Callback -1. Is that gamesalad issue?
I'm trying to get this working for an HTML5 project. Does anybody know if it should work? It works fine in the GS Preview and Android app but nothing happens with my HTML5 version @jonmulcahy @VodkaNale @The_Gamesalad_Guru
Not sure if the network behaviors work in html yet.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Thanks I got it working, but now have a new issue to fix. The game doesn't usually load at the first attempt, users need to press the refresh button
@loyaltyapps we should have a fix for that soon.
@adent42 great, rough ETA? 2 weeks / 2 months?
Hello @loyaltyapps how did you get network behaviors to work in html. I am really stuck! Please help!!
Hi @desaipj, lines 30-39 are different...
<?php //1.1.2 // connect to SQL $servername = "-"; $username ="-"; $password = "-"; $link = mysql_connect($servername, $username, $password); // database connection strings. change these to your DB and Table names. $dbName = "-"; $tableName = "-"; if (!$link) { //exit('Error: Could not connect to MySQL server!'); echo mysql_errno($link) . ": " . mysql_error($link). "\n"; } // connect to the table mysql_select_db($dbName)or die("cannot select DB"); // lets prepare some files to capture what is going on. $incomingJson = 'json.txt'; //$fullArray = 'fullArray.txt'; // needed if you enable the debugging secton below $sqlErrorLog = "sqlErrors.txt"; // initialize the string with a blank value $string = ""; // start SEND data if ($_SERVER['REQUEST_METHOD'] === 'POST') { //capture incoming data error_reporting(1); if (preg_match('/text\//', $_SERVER["CONTENT_TYPE"])) { $inputPARAMS = file_get_contents('php://input'); parse_str($inputPARAMS, $_POST); } $sig = $_POST["sig"]; $jsondata = $_POST["params"]; // this line captures the sent data so you can figure out what you need to send back. file_put_contents($incomingJson,$jsondata); // this line tells the application that the data send was successful. echo '{"Status":"Success"}'; // convert JSON to an array $array = json_decode($jsondata, TRUE); /* // formats the array to view it easier $results = print_r($array,true); file_put_contents($fullArray,$results); */ //get the total number of objects in the array $arrlength = count($array['Children']['1']['Properties']); // set while loop index $i = 0; //loop through array node and get row values while ($i < $arrlength ) { // get row value $value = $array['Children']['1']['Properties'][$i]['Value']."\n"; // convert delimited string to an array $arrayPieces = explode("|", $value); // get array values. This section would have to be modified to capture each value you are interested in. $rowName = $arrayPieces[0]; // this variable will be blank if you don't name your rows. $playerID = $arrayPieces[1]; $playerName =$arrayPieces[2]; $playerStats = $arrayPieces[3]; // construct SQL statement $sql="INSERT INTO ".$tableName."(playerID, playerName, playerStats)VALUES('$playerID', '$playerName', '$playerStats')"; // insert SQL statement $result=mysql_query($sql); // catch any errors if($result){ // if successful do nothing for now. } else { // if failure, write to custom log $sqlError = "Error writing to database\n"; file_put_contents($sqlErrorLog, $sqlError, FILE_APPEND); } $i++; } } // end of POST // close the SQL connection mysql_close($link); ?>Thank you! @loyaltyapps I have been trying to make it work on the GS arcade...do you know how to make it work on that. I set up login and posting score by sending table to url of gamesparks and getting it back to game salad. It works on preview but not on arcade. DO you know how to make it work on arcade?? This would really help
I haven't tried using HTML5 yet but Im assuming from your comments that network behaviors work on that...? I will have to try to use that if there is no way to use network behaviors on arcade @loyaltyapps
Yeah they work on HTML5 using the above Send.php code (not sure how to format it properly on here). Not sure about Arcade but my understanding is that there's no reason to be using Arcade instead of HTML5.
None of the scripts are available anymore. Can you publish your script and all work you did please. It would really help alot!!!!! My game is useless without this @loyaltyapps
Sorry for all the requests @loyaltyapps I have never used HTML5 before so I'm completely clueless. I really appreciate your help!!!! I have no idea what I am supposed to do so your advice is really helpful!
I'll quickly set this up for anyone that doesn't wish to figure it out themselves: http://gshelper.com/product/network-behaviors-full-set-up-for-cross-platform-leaderboards-with-keyboard-data-collection-etc/