CodeIgniter library for consuming RajaOngkir API. This library is an update from hok00age which is not updated. This library can be used for all types of accounts (starter, basic and pro).
NOTE: This repo is no longer being maintained. If you would like to take it over please email me at andisis92@gmail.com.
Place the file in the right place
application/controllers/Rajaongkir.php
toapplication/controllers
config/rajaongkir.php
toconfig
libraries/RajaOngkir
tolibraries
libraries/rajaongkir.php
tolibraries
Open "application/config/rajaongkir.php", enter the API key and change the account type.
First, load the RajaOngkir library or autoload it in config/autoload.php
.
$this->load->library('rajaongkir');
# Get all province
$provinces = $this->rajaongkir->province();
# Get all cities
$cities = $this->rajaongkir->city();
# Get districts based on cities
$subdistrict = $this->rajaongkir->subdistrict(151); // city_id = 151
# Get shipping costs
$cost = $this->rajaongkir->cost(501, 114, 1000, "jne");
The resulting response is a JSON string reply from RajaOngkir.