GithubHelp home page GithubHelp logo

yuvalka / php-client-library Goto Github PK

View Code? Open in Web Editor NEW

This project forked from onehourtranslation/php-client-library

1.0 1.0 0.0 77 KB

PHP Client library for OneHourTranslation API

Home Page: http://www.onehourtranslation.com

php-client-library's Introduction

OneHourTranslation API Library for PHP

Introduction

One Hour Translation™ provides translation, proofreading and transcription services worldwide. The following API library allows customers to submit and monitor translation and proofreading jobs automatically and remotely.

Preconditions and Dependencies

Authentication

  1. Register as a customer on onehourtranslation.com.
  2. Request your API Keys here.

Dependencies

  1. PHP >5.0
  2. PHP cURL Library

Starters' Guide

Configuration

The API Library must be configured before calling any API method.

One method of configuration is done on object construction:

require_once 'path/to/OHTAPI.php';
$oht = new OHTAPI(array(
	'account_id',
	'secret_key',
	FALSE // or TRUE for using OHT Sandbox environment
));

If you plan on using multiple OHT accounts, use the above method. If you plan on using only one OHT account, you may use the following method instead:

require_once 'path/to/OHTAPI.php';
OHTAPI::config(array(
	'account_id',
	'secret_key',
	FALSE // or TRUE for using OHT Sandbox environment
));
$oht = OHTAPI::instance();

Running Methods

Once configure and initialized, you are ready to call API methods. For example, requesting account details:

$result = $oht->getAccountDetails();
var_dump($result);

On success, you may expect receiving a stdClass object populated with the relevant results.

Complete Example

require_once 'path/to/OHTAPI.php';
try {
    OHTAPI::config(array(
    	'account_id',
    	'secret_key',
    	FALSE // or TRUE for using OHT Sandbox environment
    ));
    $oht = OHTAPI::instance();
    $result = $oht->getAccountDetails();
    var_dump($result);
}catch(Exception $e){
	echo $e;
}

Where to go from here?

  1. The easiest way to learn about features and implementation is to review and run the php examples in the "examples" folder of this library.
  2. Use the api-console.php file in the examples folder to manually invoke API requests (don't forget to put this file under your web root folder).
  3. Read the complete API documentation.

php-client-library's People

Stargazers

Yuval avatar

Watchers

Yuval 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.