Php RESTFUL web服务响应解析问题
我也得到了RESTfulWeb服务响应。但我无法正确解析它 我的代码如下所示Php RESTFUL web服务响应解析问题,php,xml,rest,Php,Xml,Rest,我也得到了RESTfulWeb服务响应。但我无法正确解析它 我的代码如下所示 include 'RestClient.class.php'; error_reporting(E_ALL); // Client Profile $url = "http://localhost/lgen/index.php/api/client"; $ex = RestClient::get($url,array('requestType' =>'viewClientProfile',
include 'RestClient.class.php';
error_reporting(E_ALL);
// Client Profile
$url = "http://localhost/lgen/index.php/api/client";
$ex = RestClient::get($url,array('requestType' =>'viewClientProfile',
'username' => 'uname',
'pass' =>'pass'));
echo $response = $ex->getResponse();
$xml = simplexml_load_string($response);
打印$response时,我在浏览器上获取数据,但在尝试解析它时,没有获取任何类型的数据
echo $response = $ex->getResponse();
您正在同时创建和回显一个变量
试试这个:
$xml = simplexml_load_string($ex->getResponse());
var_dump($xml);
那么问题是什么?您是否有任何错误?打印$response时,我在浏览器上获取数据,但在尝试解析数据时,我没有获取任何类型的数据我有一个类似78cytechqweasd123345456mnbzxControly2State2Country2的xml我如何使用简单的xml解析它?阅读并查看。嗨,Simone我可以打印响应,但无法解析它