<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use GuzzleHttp\Client;
class ROS_model extends CI_model
{
private $_client;
public function __construct()
{
$this->_client = new Client([
'base_uri' => 'https://10.10.33.21/rest/',
'auth' => ['admin', 'admin'],
'verify' => false
]);
}
public function IP_address()
{
$response = $this->_client->request('GET', 'ip/address');
$body = $response->getBody();
$result = json_decode($body, true);
print_r($result);
}
public function AddPPP()
{
$response = $this->_client->request('PUT', 'ppp/secret', [
'headers' => ['Content-type: application/json'],
'body' => json_encode(
array(
'name' => 'test',
'password' => '123',
'profile' => 'default'
)
),
],
);
$body = $response->getBody();
$result = json_decode($body, true);
print_r($result);
}
Comments