PHP
From MyMobileWorkers API
Since PHP as built in functions to encode/decode JSON it provides a quick and easy method to test the API.
Using OOP is the most sensible approach so create a class called Job.
Job.php
class Job { public $job_number; public $address_1; public $address_2; public $contact_name; public $contact_number_1; public $contact_number_2; public $mobile_user = array();//username not id public $postcode; public $type = 'repair';//job type in mmw public $timeslot; public $special_instructions; public $repair_description; function __construct(){ //Here you could pass an ID and populate the job from a mysql record etc.. $job_number = "TEST_JOB01"; $address_1 = "ADDRESS LINE 1"; -------- populate further records $repair_description = "Faulty whatsit"; } function getJSON(){ // we have a container array so the structure what the API expects // we send 1 job at a time but the api can handle an array of jobs. We send an array ($container) of 1 job basically. $jobs = array(); $container = array(); $container[] = $this; $jobs['jobs'] = $container; return json_encode($jobs); } }