tarantoo Posted March 30, 2012 Share Posted March 30, 2012 Hello, I want to ask you, how to code the next problem I want to transfer some coins from site A to site B, I have access to both sites. My question is, how can I update table on site B, when I send request for updating on site A. Basicly, I need to transfer value from site A, and site B should receive this value, and update table. How can I do it, what do I need? Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted March 30, 2012 Share Posted March 30, 2012 you would either need remote access to the db server on site b from site a or a cURL script to pass info to a script on site b from site a Quote Link to comment Share on other sites More sharing options...
tarantoo Posted March 30, 2012 Author Share Posted March 30, 2012 Ok, thanks! I will try with cURL. Quote Link to comment Share on other sites More sharing options...
cpd Posted March 30, 2012 Share Posted March 30, 2012 You should be able to setup a trigger and send the information across to the other server. Quote Link to comment Share on other sites More sharing options...
stenbom Posted March 30, 2012 Share Posted March 30, 2012 What you will want is as stated; cURL. What you actually are doing is a small REST implementation. Quote Link to comment Share on other sites More sharing options...
tarantoo Posted April 3, 2012 Author Share Posted April 3, 2012 I didn't get this working.. I don't know cULR, and I cant find good example. I still need help, and will give 5$, or donate to anybody who helps me. This is what I did for now: With this form I'm sending - The problem is that i'm using <form action> and then this gets redirected and i don't want that, also the coins dont get substracted because the form itself doesnt impact the PHP code because redirection, good thing is that reciever of cois get those coins. <?php include 'header.php'; if(isset($data)) { foreach($_POST as $key => $value) { $posts[$key] = filter($value); } if(isset($_POST['add'])){ if($data->coins <=99){ echo "Error! You Don't Have Enough Coins"; }else{ $ext1 = mysql_query("SELECT * FROM `users` WHERE `username`='{$_SESSION['username']}'"); $ext = mysql_fetch_object($ext1); if($ext->id != ""){ mysql_query("UPDATE `users` SET `coins`=`coins`-'{$_POST['coins']}' WHERE `username`='{$_SESSION['username']}'"); $message = "<div class=\"message success\"><h3>Sucess! "; }} } ?> <div class="contentbox"> <div class="head">Send Coins</div> <div class="contentinside"> <?php if(isset($error)) { ?> <div class="error">ERROR: <?php echo $error; ?></div> <?php } if(isset($success)) { ?> <div class="success">SUCCESS: <?php echo $success; ?></div> <?php } if(isset($warning)) { ?> <div class="warning">WARNING: <?php echo $warning; ?></div> <?php } ?> <form class="contentform" method="post" action="http://www.razmjeni.com/test/r.php"> User:<br/> <input type="text" name="user"/><br/><br/> Coins: <input type="text" name="coins"/><br/><br/> <br/><br/> <input style="width:100%;" name="add" type="Submit"/> </form> </div> </div> <?php } else { echo "Please login to view this page!"; } include 'footer.php'; ?> And this is receive form - basicly the same as above, only it sums up the coins.. <?php include 'header.php'; if(isset($data)) { foreach($_POST as $key => $value) { $posts[$key] = filter($value); } if(isset($_POST['add'])){ $ext1 = mysql_query("SELECT * FROM `users` WHERE `username`='{$_POST['user']}'"); $ext = mysql_fetch_object($ext1); if($ext->id != ""){ mysql_query("UPDATE `users` SET `coins`=`coins`+'{$_POST['coins']}' WHERE `username`='{$_POST['user']}'"); } } ?> <div class="contentbox"> <div class="head">Send Coins</div> <div class="contentinside"> <?php if(isset($error)) { ?> <div class="error">ERROR: <?php echo $error; ?></div> <?php } if(isset($success)) { ?> <div class="success">SUCCESS: <?php echo $success; ?></div> <?php } if(isset($warning)) { ?> <div class="warning">WARNING: <?php echo $warning; ?></div> <?php } ?> <form class="contentform" method="post"> User:<br/> <input type="text" name="user"/><br/><br/> Coins: <input type="text" name="coins"/><br/><br/> <br/><br/> <input style="width:100%;" name="add" type="Submit"/> </form> </div> </div> <?php } else { echo "Please login to view this page!"; } include 'footer.php'; ?> I need your help with this, the steps I need are: No redirection! And I can send coins to where ever the URL is specified, i.e to any server I want. Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 3, 2012 Share Posted April 3, 2012 Five dollars! Quote Link to comment Share on other sites More sharing options...
litebearer Posted April 3, 2012 Share Posted April 3, 2012 rupees - 253.25 rubles - 146.4610 Quote Link to comment Share on other sites More sharing options...
tarantoo Posted April 3, 2012 Author Share Posted April 3, 2012 lol, I just need help.. better donate something than nothing... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.