我正在尝试构建一个仪表板小部件,它将使用W3验证器在站点RSS提要上执行验证检查。他们的API文档(http://feed2.w3.org/docs/soap.html)提供方法。以下是我获取数据的函数:
$feed = \'http://domain.com/feed/\';
$request = new WP_Http;
$url = \'http://validator.w3.org/feed/check.cgi?url=\'.urlencode($feed).\'&output=soap12\';
$response = wp_remote_get ( $url );
if( is_wp_error( $response ) ) {
echo \'<p>Sorry, there was an error with your request.</p>\';
} else {
$feed_data = $response[\'body\'];
}
这是回报:http://pastie.org/4397488就我的一生而言,我似乎无法正确解析XML。是否有我应该使用的第三方库,或者是否有本机WP函数可以处理此问题?