Created
October 20, 2014 12:48
-
-
Save kolyadin/5e4f43a44dee65051d08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: text/plain; charset=utf-8'); | |
class CntSoapContentCriteria | |
{ | |
public $limit = 5; | |
public $offset = 0; | |
public $typeId = 3; | |
} | |
//$login = 'prostokvashino'; | |
//$chain = 'Aeya-h0fu3ohx8eu8-FaeKoh2ahy-ie3eex'; | |
$login = 'rastishka'; | |
$chain = 'Ou3g-ooveiSh0vaeGah7g-Aing1Eij-agh6'; | |
$datetime = new \DateTime(); | |
$date = $datetime->getTimestamp(); | |
$signature = md5(strtr( | |
'%seed%%login%: %chain%, date: %date%', array( | |
'%seed%' => 'moloko', | |
'%login%' => $login, | |
'%chain%' => $chain, | |
'%date%' => $date, | |
))); | |
$headers = array( | |
'X-PARTNER: ' . $login, | |
'X-CHAIN: ' . $chain, | |
'X-SIGNATURE: ' . $signature, | |
'DATE: ' . $date, | |
); | |
$cl = new \SoapClient( | |
'http://content.svoy.ru/?WSDL', | |
array( | |
'trace' => true, | |
'exceptions' => false, | |
'stream_context' => stream_context_create( | |
array( | |
'http' => array('header' => join(PHP_EOL, $headers)) | |
) | |
), | |
) | |
); | |
try { | |
$res = $cl->__soapCall('getContentList', array(new CntSoapContentCriteria())); | |
print '<pre>'.print_r($res,true).'</pre>'; | |
} catch (\SoapFault $e) { | |
echo $e->getMessage(); | |
print_r(array($cl->__getLastRequestHeaders(), $cl->__getLastRequest())); | |
print_r(array($cl->__getLastResponseHeaders(), $cl->__getLastResponse())); | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment