Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add some documentation

  • Loading branch information...
commit b041aae070230be453d950237ae8f77824ed510b 1 parent 3233386
oyagev authored
Showing with 23 additions and 5 deletions.
  1. +12 −1 examples/api-console.php
  2. +11 −4 examples/callback.php
View
13 examples/api-console.php
@@ -1,10 +1,14 @@
<?php
$sandbox = 'https://sandbox.onehourtranslation.com';
$prod = 'https://www.onehourtranslation.com';
-
$account_id = 269; //demo user
$secret_key = '5a68561984276108fa42d7cffbbf91a5'; //demo user
+
+
+ /*
+ * Switch between "$prod" to use production or "$sandbox" to use sandbox environment.
+ */
$url = $sandbox;
?>
@@ -21,6 +25,13 @@
Notes: <input type="text" name="notes" /><br />
Content Type: <input type="text" name="content_type" value="text/plain"/><br />
Callback URL: <input type="text" name="callback_url" /><br />
+
+ User Reference: <input type="text" name="user_reference" value=""/><br />
+ Project Reference: <input type="text" name="project_reference" value=""/><br />
+ <?php for($i=0;$i<10;$i++) : ?>
+ Custom <?php echo $i?>: <input type="text" name="custom<?php echo $i?>" value=""/><br />
+ <?php endfor?>
+
<input type="submit" value="Submit a new Project"/>
</form>
View
15 examples/callback.php
@@ -1,5 +1,12 @@
<?php
+
+/*
+ * Absolute location of a file that will hold the callback log.
+ * Caution! This file WILL be edited and may be deleted. Customize this parameter to indicate an empty files.
+ */
+$tmpDir = '/tmp/callback';
+
$result = array();
$type = (!empty($_POST['type'])) ? $_POST['type'] : NULL ;
@@ -38,11 +45,11 @@
$ob = ob_get_clean();
ob_end_clean();
-$h = fopen('/tmp/callback','a');
-fwrite($h,"*************\n");
-fwrite($h,date('Y-m-d H:i:s')."\n");
+$h = fopen($tmpDir,'a');
+fwrite($h,"*************".PHP_EOL);
+fwrite($h,date('Y-m-d H:i:s').PHP_EOL);
fwrite($h,$ob);
-fwrite($h,"\n*************\n\n");
+fwrite($h,PHP_EOL."*************".PHP_EOL.PHP_EOL);
fclose($h);
?>
Please sign in to comment.
Something went wrong with that request. Please try again.