function SetupApi($urlapi, $user, $pass) { ## Obtener el token de session = SessionID $url = "http://10.102.1.22/sifinca/web/app.php/login"; $headers = array('Accept: application/json', 'Content-Type: application/json'); $a = new api($url, $headers); echo "login\n"; print_r($a->post(array("user" => $user, "password" => $pass))); $result = $a->post(array("user" => $user, "password" => $pass)); $data = json_decode($result, true); $token = $data['id']; ## cargar objetos para inyectar a workers $headers = array('Accept: application/json', 'Content-Type: application/json', 'x-sifinca:SessionToken SessionID="' . $token . '", Username="******"'); $a->set(array('url' => $urlapi, 'headers' => $headers)); return $a; }
public function setupApi() { ## Obtener el token de session = SessionID $url = "http://www.sifinca.net/sifinca/web/app.php/login"; $headers = array('Accept: application/json', 'Content-Type: application/json'); $a = new api($url, $headers); $result = $a->post(array("user" => "*****@*****.**", "password" => "araujo123")); $data = json_decode($result); $token = $data->id; ## cargar objetos para inyectar a workers $url = "http://www.sifinca.net/sifinca/web/app.php/archive/main/history/accounting"; $headers = array('Accept: application/json', 'Content-Type: application/json', 'x-sifinca:SessionToken SessionID="' . $token . '", Username="******"'); $a->set(array('url' => $url, 'headers' => $headers)); return $a; }
protected function SetupApi($urlapi, $user, $pass) { ## Obtener el token de session = SessionID $url = "http://www.sifinca.net/sifinca/web/app.php/login"; $headers = array('Accept: application/json', 'Content-Type: application/json'); $a = new api($url, $headers); $result = $a->post(array("user" => $user, "password" => $pass)); $data = json_decode($result); $token = $data->id; $headers = array('Accept: application/json', 'Content-Type: application/json', 'x-sifinca:SessionToken SessionID="' . $token . '", Username="******"'); $a->set(array('url' => $urlapi, 'headers' => $headers)); return $a; }
public function setupApi() { ## Obtener el token de session = SessionID $url = "http://10.102.1.22/sifinca/web/app.php/login"; $headers = array('Accept: application/json', 'Content-Type: application/json'); $a = new api($url, $headers); // print_r($a->post(array("user"=>"*****@*****.**","password"=>"araujo123"))); $result = $a->post(array("user" => "*****@*****.**", "password" => "araujo123")); echo "Resultado "; print_r($result); $data = json_decode($result, true); $token = $data['id']; ## cargar objetos para inyectar a workers $url = "http://10.102.1.22/sifinca/web/app.php/admin/accounting/headofaccountingvouchercopy/zeuz"; $headers = array('Accept: application/json', 'Content-Type: application/json', 'x-sifinca:SessionToken SessionID="' . $token . '", Username="******"'); $a->set(array('url' => $url, 'headers' => $headers)); return $a; }