developer:soap-1.4:objects:uesecuritytoken

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
developer:soap-1.4:objects:uesecuritytoken [2011/05/10 09:26]
irina
developer:soap-1.4:objects:uesecuritytoken [2013/05/28 16:26] (current)
charlie [PHP 5]
Line 43: Line 43:
 <code php> <code php>
 <?php <?php
-class TokenClientExample { 
  
-    public $client; ​// initialize client +// Creating a ueSecurityToken
-    public $token;// initialize token +
-     +
-    function setUp{ +
-        $client=self::​getClient();​ //Using this class +
-        $token=self::​getToken(); ​  //​Using this class +
-    } +
-     +
-    static function getClient(){ +
-        //for live server use '​www'​ for test server use '​sandbox'​ +
-        $wsdl='​https://​www.usaepay.com/​soap/​gate/​131C979E/​usaepay.wsdl';​+
         ​         ​
-        return new SoapClient($wsdl,​array("​trace"​=>​1,"​exceptions"​=>​1));​ +$sourcekey = '​Your_source_key_here';​ //Input your merchant console generated source key 
-        //Must have Php5 compiled with --enable-soap +$pin = '​1234';​ //Input the PIN set in the source editor for your source key
-        //Otherwise use pear soap. For more info please visit: http://​pear.php.net/​package/​SOAP +
-    } +
- +
-    static function getToken(){ +
-        // Creating a ueSecurityToken +
-         +
-        ​$sourcekey = '​Your_source_key_here'; ​ +
-//Input your merchant console generated source key +
-        $pin = '​1234';​ //Input the PIN set in the source editor for your source key+
         ​         ​
-        ​// generate random seed value +// generate random seed value 
-        $seed=mktime() . rand();+$seed=mktime() . rand();
         ​         ​
-        ​// make hash value using sha1 function +// make hash value using sha1 function 
-        $clear= $sourcekey . $seed . $pin; +$clear= $sourcekey . $seed . $pin; 
-        $hash=sha1($clear);​+$hash=sha1($clear);​
         ​         ​
-        ​// assembly ueSecurityToken as an array +// assembly ueSecurityToken as an array 
-        // (php5 will correct the type for us) +// (php5 will correct the type for us) 
-        $tok=array( +$token=array( 
-         ​'​SourceKey'​=>​$sourcekey,​ + '​SourceKey'​=>​$sourcekey,​ 
-         ​'​PinHash'​=>​array( + '​PinHash'​=>​array( 
-            '​Type'​=>'​sha1',​ +  '​Type'​=>'​sha1',​ 
-            '​Seed'​=>​$seed,​ +  '​Seed'​=>​$seed,​ 
-            '​HashValue'​=>​$hash +  '​HashValue'​=>​$hash 
-            ), + ), 
-         ​'​ClientIP'​=>'​192.168.0.1'​ + '​ClientIP'​=>'​192.168.0.1'​ 
-        ); +);
-        return $tok; +
-    } +
-}+
 ?> ?>
 </​code>​ </​code>​
developer/soap-1.4/objects/uesecuritytoken.txt · Last modified: 2013/05/28 16:26 by charlie

Page Tools