send item with php and soap


i use this simple php code for send item with command :

<?php $soapUsername = 'username'; $soapPassword = 'password'; $client = new SoapClient(NULL, array( 'location' => "http://ip:port/", 'uri' => 'urn:TC', 'style' => SOAP_RPC, 'login' => $soapUsername, 'password' => $soapPassword, )); $character="Admin"; $subject="shop"; $body="Thank you for your purchase"; $item="14047:20"; $command="send items ".$character." "".$subject."" "".$body.""".$item; try { $result = $client->executeCommand(new SoapParam($command, "command")); echo "ok send"; } catch (Exception $e) { die("not send"); } ?>

but it’s not work and when i run it show “not send” how can i fix it?

[ol][li][COLOR=rgb(0,0,136)]die[COLOR=rgb(102,102,0)]([COLOR=rgb(0,136,0)]“not send”[COLOR=rgb(102,102,0)]);[/li]
[li]isnt needed because catch() case already exits the script.[/li][/ol]

Perhaps dump the error instead of just printing “not send” /emoticons/default_wink.png


Also, @Scias, catch does not necessarily end the script, the point of catching errors is to allow execution to continue even though something went wrong. If this file would be included from an other php script, it definitely does make a difference if you use die there or not. Whether that is the intended behaviour is questionable of course.

maybe add a space ?



$body.“” ".$item;
Hint: Make echo $command and copy the result into the console to check if it will be accepted.