https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/kanvakanva.com/public_html/application/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/kanvakanva.com/public_html/application/helpers/rajaongkir_helper.php
<?php

function get_rajaongkir_data($uri) {

	$curl = curl_init(); 

	curl_setopt_array($curl, array(
	  CURLOPT_URL => 'http://pro.rajaongkir.com/api/' . $uri,
	  CURLOPT_RETURNTRANSFER => true, //not to print result, but return curl_exec as string, not as true/false
	  CURLOPT_ENCODING => "",
	  CURLOPT_MAXREDIRS => 10, // The maximum amount of HTTP redirections to follow. Use this option alongside CURLOPT_FOLLOWLOCATION.
	  CURLOPT_TIMEOUT => 30, //tell the script how long to wait to receive a completely buffered output from the server
	  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	  CURLOPT_CUSTOMREQUEST => "GET",
	  CURLOPT_HTTPHEADER => array(
	    'key: 29b58cf87972eb123e184225147ce577'
	  ), 
	));

	$response = curl_exec($curl);
	$err = curl_error($curl);

	curl_close($curl);

	if ($err) {
	  echo "cURL Error #:" . $err;  

	} else {

	  return json_decode($response, true); //true means dcode json to array.
	}	
}	



function get_rajaongkir_ongkos($origin_city_id, $destination_city_id, $weight, $carrier) {

	$curl = curl_init();

	curl_setopt_array($curl, array(
	  CURLOPT_URL => 'http://pro.rajaongkir.com/api/cost',
	  CURLOPT_RETURNTRANSFER => true,
	  CURLOPT_ENCODING => "",
	  CURLOPT_MAXREDIRS => 10,
	  CURLOPT_TIMEOUT => 30,
	  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	  CURLOPT_CUSTOMREQUEST => "POST",
		
		CURLOPT_POSTFIELDS => 'origin=' . $origin_city_id . 
	  '&originType=city&destination=' . $destination_city_id . '&destinationType=city&weight=' . $weight . '&courier=' . $carrier,


	  CURLOPT_HTTPHEADER => array(
	    "content-type: application/x-www-form-urlencoded",
	    "key: 29b58cf87972eb123e184225147ce577"
	  ),
	));

	$response = curl_exec($curl);
	$err = curl_error($curl);

	curl_close($curl);

	if ($err) {
	  echo "cURL Error #:" . $err;
	} else {
	  return json_decode($response, true);
	}	
	
}	

function get_anteraja_cost($origin_subdistrict_id, $destination_subdistrict_id, $weight) {

	if($weight < 1000) {
		$weight = 1000;
	}

	$curl = curl_init();

	$data = array("origin" => $origin_subdistrict_id, "destination" => $destination_subdistrict_id, "weight"=> $weight);
	$postdata = json_encode($data);

	curl_setopt_array($curl, array(
	  CURLOPT_URL => 'https://doit-sit.anteraja.id/kanva/serviceRates',
	  CURLOPT_RETURNTRANSFER => true,
	  CURLOPT_ENCODING => "",
	  CURLOPT_MAXREDIRS => 10,
	  CURLOPT_TIMEOUT => 30,
	  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
		CURLOPT_CUSTOMREQUEST => "POST",
		CURLOPT_POSTFIELDS => $postdata,
	  CURLOPT_HTTPHEADER => array(
	    "content-type: application/json",
			"access-key-id: Anteraja_x_Kanva_SIT",
			"secret-access-key: SYRzSiaro+a9U0wa5munOw==",	
	  ),
	));

	$response = curl_exec($curl);
	$err = curl_error($curl);

	curl_close($curl);

	if ($err) {
	  echo "cURL Error #:" . $err;
	} else {
	  return json_decode($response, true);
	}	
	
}	

https://t.me/RX1948 - 2025