Jump to content

Send value from server 1 to server 2


tarantoo

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.