Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function get_session_auth($username,$password){
- $resultArray = array(
- 'result' => 'succeeded',
- 'resultText' => null
- );
- $request = new HTTP_Request2($this->baseUrl. 'index.php/login/get_session_id_via_login?username='.$username.'&password='.$password, HTTP_Request2::METHOD_GET);
- if (ENVIRONMENT === 'development') {
- $request->setConfig(array('ssl_verify_peer' => false));
- }
- //$request->setAdapter('curl');
- try {
- $response = $request->send();
- if (200 == $response->getStatus()) {
- $resultArray = json_decode($response->getBody(), true);
- } else {
- $resultArray['result'] = 'failed';
- $resultArray['resultText'] = 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
- $response->getReasonPhrase();
- // Here we should write data to log file.
- $this->getLogger()->error($resultArray['resultText']);
- }
- } catch (HTTP_Request2_Exception $e) {
- $resultArray['result'] = 'failed';
- $resultArray['resultText'] = 'Error: ' . $e->getMessage();
- // Here we should write data to log file.
- $this->getLogger()->error($resultArray['resultText']);
- }
- $resultArray['operation_name'] = 'get_session_auth';
- return $resultArray;
- }
- $session_id = session_id();
- return $session_id;
- public function dosomething($session_id)
- {
- $resultArray = array(
- 'result' => 'succeeded',
- 'resultText' => null
- );
- $request = new HTTP_Request2($this->baseUrl. 'index.php/payment/dosomething/true?session_id='.$session_id, HTTP_Request2::METHOD_GET);
- if (ENVIRONMENT === 'development') {
- $request->setConfig(array('ssl_verify_peer' => false));
- }
- //$request->setAdapter('curl');
- try {
- $response = $request->send();
- if (200 == $response->getStatus()) {
- $resultArray = json_decode($response->getBody(), true);
- } else {
- $resultArray['result'] = 'failed';
- $resultArray['resultText'] = 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
- $response->getReasonPhrase();
- // Here we should write data to log file.
- $this->getLogger()->error($resultArray['resultText']);
- }
- } catch (HTTP_Request2_Exception $e) {
- $resultArray['result'] = 'failed';
- $resultArray['resultText'] = 'Error: ' . $e->getMessage();
- // Here we should write data to log file.
- $this->getLogger()->error($resultArray['resultText']);
- }
- $resultArray['operation_name'] = 'dosomething';
- return $resultArray;
- }
- session_id( 'session_id' );
- session_start();
Add Comment
Please, Sign In to add comment