Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php strstr-无法正确使用XML响应(符号)_Php_Strstr - Fatal编程技术网

Php strstr-无法正确使用XML响应(符号)

Php strstr-无法正确使用XML响应(符号),php,strstr,Php,Strstr,迈克尔要求编辑的文章 $Response = $soapClient->__getLastResponse(); $pos = strpos($Response, ">"); echo substr($Response, $pos+1); // Returns soap:ReceiverServer was unable to process request. ---> Product already exists $Response = $soapClient->__

迈克尔要求编辑的文章

$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无法处理请求。-->产品已存在

我正在尝试删除
产品之前的所有内容
,因此我只需要向用户显示错误消息。然而,当我使用它时,我得到了以下回报

>soap:ReceiverServer无法处理请求。-->产品已存在

这是我目前正在使用的代码。有人有什么建议吗

$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
$Response=$soapClient->\uu getLastResponse();
回音$应答;
//如下所示
//soap:ReceiverServer无法处理请求。-->产品已存在
$test=strstrstr($Response,'>');
回音'
' 回声试验; //如下所示 //>soap:ReceiverServer无法处理请求。-->产品已存在
Hi@Michael这返回以下
soap:ReceiverServer无法处理请求。-->产品已经存在
这很奇怪。。。看看php沙盒:你能用我建议的修改粘贴你的代码吗?当然,第一篇文章已经编辑好了。我添加了两个版本(其中一个我试图强制转换为字符串)。您需要在语句末尾加“;”。您的$Response是字符串,对吗?你能把剩下的代码贴出来吗?这应该与您提供的信息配合使用。您是否尝试了指向php沙盒的链接?
$Response = "soap:ReceiverServer was unable to process request. --- >   Product already exists";
$pos = strpos($Response, ">");
echo substr($Response, $pos+1);