Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: nateswanson
- * Date: 8/21/18
- * Time: 10:30 AM
- */
- $api_url = 'http://spotix.local/index.php/api/soap/?wsdl';
- $user = 'soap_user';
- $pass = 'password';
- $params = array('location'=>$api_url, 'soap_version' => SOAP_1_1, 'encoding' => 'UTF-8', 'verifypeer' => false, 'verifyhost' => false, 'trace' => 1, 'exceptions' => 1, "connection_timeout" => 180);
- $client = new SoapClient($api_url, $params);
- try{
- $session = $client->login($user, $pass);
- $result = $client->resources($session);
- }catch(Exception $e){
- echo '<pre>';
- print_r($client);
- echo '</pre>';
- return;
- }
- echo '<pre>';
- var_dump($result);
- echo '</pre>';
- $client->endSession($session);
- ?>
- SoapClient Object
- (
- [location] => http://spotix.local/index.php/api/soap/?wsdl
- [trace] => 1
- [_encoding] => UTF-8
- [_connection_timeout] => 180
- [_soap_version] => 1
- [sdl] => Resource id #2
- [__last_request] =>
- soap_userpassword
- [httpsocket] => Resource id #3
- [_use_proxy] => 0
- [httpurl] => Resource id #4
- [__last_request_headers] => POST /index.php/api/soap/?wsdl HTTP/1.1
- Host: spotix.local
- Connection: Keep-Alive
- User-Agent: PHP-SOAP/5.6.36
- Content-Type: text/xml; charset=utf-8
- SOAPAction: "urn:Mage_Api_Model_Server_HandlerAction"
- Content-Length: 540
- [__last_response_headers] => HTTP/1.1 200 OK
- Date: Tue, 21 Aug 2018 20:22:29 GMT
- Server: Apache
- X-Powered-By: PHP/5.6.36
- Expires: Thu, 19 Nov 1981 08:52:00 GMT
- Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
- Pragma: no-cache
- Set-Cookie: PHPSESSID=kj5rv20qo5d1s2jfj3kfo8fn31; expires=Wed, 22-Aug-2018 06:22:30 GMT; Max-Age=36000; path=/; domain=spotix.local; HttpOnly
- Upgrade: h2,h2c
- Connection: Upgrade, Keep-Alive
- Keep-Alive: timeout=5, max=100
- Transfer-Encoding: chunked
- Content-Type: text/xml; charset=UTF-8
- [_cookies] => Array
- (
- [PHPSESSID] => Array
- (
- [0] => kj5rv20qo5d1s2jfj3kfo8fn31
- [1] => /
- [2] => spotix.local
- )
- )
- [__last_response] =>
- Call api functionality
- Multiple calls of resource functionality
- End web service session
- Login user and retrive session id
- Start web service session
- List of available resources
- List of resource faults
- List of global faults
- [__soap_fault] => SoapFault Object
- (
- [message:protected] => Wrong Version
- [string:Exception:private] =>
- [code:protected] => 0
- [file:protected] => /private/var/www/html/soap/SOAP_test.php
- [line:protected] => 17
- [trace:Exception:private] => Array
- (
- [0] => Array
- (
- [file] => /private/var/www/html/soap/SOAP_test.php
- [line] => 17
- [function] => __call
- [class] => SoapClient
- [type] => ->
- [args] => Array
- (
- [0] => login
- [1] => Array
- (
- [0] => soap_user
- [1] => password
- )
- )
- )
- [1] => Array
- (
- [file] => /private/var/www/html/soap/SOAP_test.php
- [line] => 17
- [function] => login
- [class] => SoapClient
- [type] => ->
- [args] => Array
- (
- [0] => soap_user
- [1] => password
- )
- )
- )
- [previous:Exception:private] =>
- [faultstring] => Wrong Version
- [faultcode] => VersionMismatch
- [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/
- )
- )
Add Comment
Please, Sign In to add comment