Author

Topic: newbi mtgox API help, basic php (Read 743 times)

newbie
Activity: 46
Merit: 0
April 16, 2013, 02:31:09 AM
#8
I got it to connect;

Code:
$history = $api->get_wallet_history('USD');
print_r($history);

dumps my history

yet, still trying to figure out withdrawls

Code:
include ("mtgox_api_base.php");
include ("mtgox_private_api.php");
include ("mtgox_public_api.php");

//include ("mtgox_api_objects.php");

echo "test";

$api = new MtGox_Private_Api();
$api->set_currency('USD');
$api->set_authentication('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS');



$history = $api->get_wallet_history('USD');
print_r($history);





//withdrawl sample 1btc
$address = "1PetPrN5xDimsYENtJNW6gBUbmjZ5H9xdm";
$amount_int = "90000000";
$fee_int= "000000000";

$withdrawl = $api->withdraw_coins($address, $amount_int, $fee_int=null, $no_instant=null, $green=null);

//print recipt?
print_r ($withdrawl);

echo "test";

assume amount is in satoshi?
Im not even getting an error or anything, just a white page with the "test" showing
newbie
Activity: 46
Merit: 0
April 16, 2013, 01:19:52 AM
#7
im useing the newer API v1 then that original post.

this is an example useing the class

https://github.com/daftspunk/php-mtgox-v1/blob/master/examples/dirty_daytrader.php

why I tried the 3 includes

include '../mtgox_api_base.php';
include '../mtgox_private_api.php';
include '../mtgox_public_api.php';

not a withdrawl in their :/


simply trying to call to this function

Code:
// Send bitcoins from your account to a bitcoin address.
    public function withdraw_coins($address, $amount_int, $fee_int=null, $no_instant=null, $green=null)
    {
        return $this->send_request(self::uri_withdraw_coins);
    }
member
Activity: 70
Merit: 10
April 15, 2013, 10:57:44 PM
#6
Code:
include ("gox.class.php");

$gox = new Gox('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS');

echo 
"test";
$info->getinfo($gox);
var_dump ($info);
?>

You need to include the file, before you can call the class.
newbie
Activity: 46
Merit: 0
April 15, 2013, 10:54:44 PM
#5
bump Embarrassed
newbie
Activity: 46
Merit: 0
April 15, 2013, 04:24:55 PM
#4
im stuck!

I take it this is an old API

Code:
// old api (get funds)
var_dump(mtgox_query('0/getFunds.php'));
 
// trade example
// var_dump(mtgox_query('0/buyBTC.php', array('amount' => 1, 'price' => 15)));



I found a new class for v1

https://github.com/daftspunk/php-mtgox-v1


this is what I got so far.

Code:
include ("mtgox_private_api.php");
include (
"mtgox_api_base.php");
include (
"mtgox_api_objects.php");
 
 
$api = new MtGox_Private_Api();
$api->set_currency('USD');
$api->set_authentication('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS');
 
 
$history $api->get_wallet_history('USD');
print_r($history);
 
 
//withdrawl sample 1btc
$address "1PetPrN5xDimsYENtJNW6gBUbmjZ5H9xdm";
$amount_int "100000000";
$fee_int".0005";
 
$withdrawl $api->withdraw_coins($address$amount_int$fee_int=null$no_instant=null$green=null);
 
//print recipt?
var_dump ($this);
 
echo 
"test";
 
?>




http://25.media.tumblr.com/tumblr_lsxtglsUrC1qmhv2lo1_500.jpg
newbie
Activity: 46
Merit: 0
April 15, 2013, 03:07:28 PM
#3
ohh wow, yea that worked much better. just entered my API info and got my var_dump


Im going to be trying to set up a withdrawal now and see If I run into any trouble.
cmp
newbie
Activity: 15
Merit: 0
April 15, 2013, 03:03:03 PM
#2
Look at the API code here: https://en.bitcoin.it/wiki/MtGox/API/HTTP#PHP

I think it's easier to understand. The Gox.class is using this code.
newbie
Activity: 46
Merit: 0
April 15, 2013, 02:59:58 PM
#1
just started accepting btc donations on my site.

right now its just getting stored on mtgox so It can keep a portion in dollars.

I want to set up a "getinfo" so I can see how much is in my account. And Eventually set up an automated monthly withdrawl of bitcoin to a offline wallet.

I found a github of what looks like a simple php mtgox api class

https://github.com/Someguy123/MtGOX-PHP-API


here is my code so far

Code:
$gox = new Gox('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS');


include (
"gox.class.php");
echo 
"test";
$info->getinfo($gox);
var_dump ($info);
?>


for refece the function im trying to call too is

Code:
function getInfo() {
        $info = $this->mtgox_query('0/info.php');
        $this->info = $info; // Hold it in a variable for easy access
        return $info;
    }

thanks
Jump to: