Title: Help inserting courier API
Last modified: August 30, 2016

---

# Help inserting courier API

 *  [kcsim99@gmail.com](https://wordpress.org/support/users/kcsim99gmailcom/)
 * (@kcsim99gmailcom)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/help-inserting-courier-api/)
 * Hi everyone,
 * I’m running a ecommerce site on Woocommerce 2.4.7 plugin, and with the Flatsome
   child theme.
 * Up till now, I have been doing this myself using help from online forums and 
   plugins to pull this off.
 * The thing now is that my courier service has an API which needs to be inserted
   into the store code. I’m a bit lost as to how to do this as I’m not exactly a
   programmer. This is the code which needs to be inserted. Any help will be greatly
   appreciated.
 *     ```
       $url = 'http://cs.maxcellents.com.sg/max_api.php';
   
        $fields = array( 'userid' => urlencode('User ID'),
   
        'password' => urlencode('Password'), 
   
        'Name' => urlencode('Name'), 
   
        'Address' => urlencode('Address'), 
   
        'Postal' => urlencode('Postal'), 
   
        'Telephone' => urlencode('Contact'), 
   
        'Email' => urlencode('Email'), 
   
        'Remark' => urlencode('Remarks'), 
   
        'value' => urlencode('Parcel Value') ); 
   
        foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } 
   
        rtrim($fields_string, '&'); 
   
        $ch = curl_init(); 
   
        curl_setopt($ch,CURLOPT_URL, $url); 
   
        curl_setopt($ch,CURLOPT_POST, count($fields)); 
   
        curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); 
   
        $result = curl_exec($ch); 
   
        $trackin = json_decode($result, true); 
   
        if (isset($trackin["error"])) 
   
        { 
   
        //handle error 
   
        } 
   
        if (isset($trackin["trackNumber"])) 
   
        { 
   
        //handle tracking number 
   
        } 
   
        curl_close($ch);
       ```
   
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

The topic ‘Help inserting courier API’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 0 replies
 * 1 participant
 * Last reply from: [kcsim99@gmail.com](https://wordpress.org/support/users/kcsim99gmailcom/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/help-inserting-courier-api/)
 * Status: not resolved