$value) { $_post[] = $name.'='.urlencode($value); } } $ch = curl_init($end_point); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); if (is_array($post)) { curl_setopt($ch, CURLOPT_POSTFIELDS, join('&', $_post)); } curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)'); $result = curl_exec($ch); if (curl_errno($ch) != 0 && empty($result)) { $result = false; } curl_close($ch); return $result; } $api_url = 'https://virtusim.com/api/json.php'; // api url // contoh membuat pesanan $post_data = array( 'api_key' => 'apikeyanda', // api key Anda 'action' => 'order', 'service' => '26', // id layanan 'operator' => 'indosat' //telkomsel,axis,indosat,any(random) ); //contoh get sms otp // $post_data = array( // 'api_key' => 'apikeyanda', // api key Anda // 'action' => 'active_order' // ); //contoh check status pesanan // $post_data = array( // 'api_key' => 'apikeyanda', // api key Anda // 'action' => 'status', // 'id' => '9323' // id layanan // ); //contoh merubah status pesanan / set status // $post_data = array( // 'api_key' => 'apikeyanda', // api key Anda // 'action' => 'set_status', // 'id' => '9323', // id layanan // 'status' => '1' //1 = ready, 2=cancel, 3=resend, 4=selesai // ); // contoh Get Layanan // $post_data = array( // 'api_key' => 'apikeyanda', // api key Anda // 'action' => 'services' // ); $api = connect($api_url, $post_data); echo $api;