<?php
class curl extends CI_Controller {
public function __construct()
{
// created the construct so that the helpers, libraries, models can be loaded all through this controller
parent::__construct();
$this->load->helper('url');
$this->load->library('xmlrpc');
$this->load->library('xmlrpcs');
}
public function index()
{
//curl
$mytoken = array('act'=>'GetToken', 'username'=>'*****', 'password'=>'*******');
$payload = json_encode($mytoken);
$ch = curl_init('http://192.168.30.99:8082/ws/live2.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($payload))
);
$data = curl_exec($ch);
if (curl_errno($ch))
{
print "Error: " . curl_error($ch);
}
else
{
// Show me the result
$transaction = json_decode($data, TRUE);
curl_close($ch);
var_dump($transaction['data']);
}
}
}
Cetak Surat Keputusan Controller: <?php //File in controller named surat_keputusan.php defined('BASEPATH') OR exit('No direct script access allowed'); class Cetak_surat_keputusan extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->database(); $this->db->select(); $this->db->from('surat.config_sk'); $query = $this->db->get(); return $query->result(); } public function index() { ...
Comments
Post a Comment