Code Monkey home page Code Monkey logo

mtgox-php-api's Introduction

What is this?

The MtGOX API is sort-of confusing for some, and can be annoying to work with, So, I have created a simple class file which makes using the API fairly easy by creating functions which automatically parse the API into normal PHP arrays that are easy to implement in your normal PHP scripts.

tl;dr This is a PHP class to let you jump straight into the MtGox API without having to write your own methods to access it

It's released under the LGPL, which means you CAN use it in a proprietary script as long as you keep the copyright notice, and let people know that you're using it.

How do I use it in my applications?

Place Gox.class.php in the same directory as your script and include the file. Directly below that, or where it is needed, initialize the class by giving it your API Key and secret obtained from the MtGox Security Centre under Advanced API Key Creation

$gox = new Gox('myLongAPIKey', 'Mysecretsecret');

Not much else needs to be explained, I have documented each function with phpDocumentor comments, so if you use an IDE like phpDesigner, it should explain every function as you type them. If not, just open up the class in your favourite editor and read through the comments, they're pretty self explanatory.

EXAMPLE CODE

<?php
include("Gox.class.php");
// Change these values to the ones obtained from http://mtgox.com/security
$gox = new Gox("YourAPIKey", "YourAPISecret");
$ticker = $gox->ticker(); // No parameters defaults to BTCUSD
if($ticker['result'] == "success") {
    echo "The current average price for BTC in USD is "
	.$ticker['data']['avg']['value']
	."\r\n";
} else {
    echo "An error occurred obtaining the ticker";
}
?>

This code will output something similar to this:

The current average price for BTC in USD is 130.33057

DEPENDENCIES

  • PHP 5
  • cURL (Please remember to enable it!)

LICENSE/COPYRIGHT NOTICE

THIS SCRIPT HAS BEEN RELEASED UNDER THE LGPL V3. Please make sure that you understand the LGPL before using my class in your application.

DONATIONS

Donations are accepted:

  • BTC: 1SoMGuYknDgyYypJPVVKE2teHBN4HDAh3
  • LTC: LSomguyTSwcw3hZKFts4P453sPfn4Y5Jzv

If this script has helped you, please donate to the Bitcoin or Litecoin address above ^

mtgox-php-api's People

Contributors

eldereal avatar lohoris avatar someguy123 avatar theblazehen avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.