2016-12-22 1 views
-1

編集された投稿がMichaelによって要求されました。strstr - XMLレスポンス(シンボル)で正しく動作しない

$Response = $soapClient->__getLastResponse(); 
$pos = strpos($Response, ">"); 
echo substr($Response, $pos+1); 
// Returns soap:ReceiverServer was unable to process request. ---> Product already exists 

$Response = $soapClient->__getLastResponse(); 
$converted = (string)$Response 
$pos = strpos($converted, ">"); 
echo substr($converted, $pos+1); 
// Returns soap:ReceiverServer was unable to process request. ---> Product already exists 

私はAPIを使用して、エラーメッセージとして応答を使用したいのです。応答は次のようになります。

soap:ReceiverServer was unable to process request. ---> Product already exists

私はので、私はちょうど、ユーザーに表示するエラーメッセージを持っているProduct前に、すべてのものを削除しようとしています。しかし、私がこれを使うと、私は次のように答えを得ます。

>soap:ReceiverServer was unable to process request. ---> Product already exists

これは私が現在使用しているコードです。誰か提案はありますか?

$Response = $soapClient->__getLastResponse(); 
echo $Response; 
// Shows the below 
// soap:ReceiverServer was unable to process request. ---> Product already exists 

$test = strstr($Response, '>'); 
echo '<br>' 
echo $test; 
// Shows the below 
// >soap:ReceiverServer was unable to process request. ---> Product already exists 

答えて

0
$Response = "soap:ReceiverServer was unable to process request. --- > Product already exists"; 
$pos = strpos($Response, ">"); 
echo substr($Response, $pos+1); 
+0

こんにちは@Michaelこれは、次の '石鹸を返します。ReceiverServerは要求を処理できませんでした。 ---> Product already exists' – Jake

+0

これは変です... PHPサンドボックスを見てください: http://sandbox.onlinephpfunctions.com/code/0a239f502623c69f88d81a2f0c74e665f3d55171 – Michael

+0

私が提案した変更でコードを貼り付けることはできますか? – Michael

関連する問題