如何将 Last.fm XML-RPC 响应与 CodeIgniter 结合使用?
几天前,我发布了一个关于如何请求用户的问题来自带有 codeigniter 和 xmlrpc 的 lastfm 的最近曲目 请求工作正常,但我仍然不知道如何使用响应...这就是我到目前为止所做的:
我的 xml-rpc 问题是我得到的响应是一个字符串...
if(!$this->xmlrpc->send_request())
{
$data["response"] = $this->xmlrpc->display_error();
}
else {
$data["response"] = $this->xmlrpc->display_response();
}
var_dump说 $data["response"] 是一个字符串(4293)...
我尝试了 var_dump(simplexml_load_string($response));
但出现错误:
Message: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, '<' not found
那么我应该如何使用此响应?
xml-rpc 在 CodeIgniter 用户指南中的记录太糟糕了...:(
A few days ago I had posted a questions about how to Request user recenttracks from lastfm with codeigniter and xmlrpc
The request works fine, but still i can't figure out how to use the response...This is what I have done so far:
My Problem with xml-rpc is that the response that I get is a string...
if(!$this->xmlrpc->send_request())
{
$data["response"] = $this->xmlrpc->display_error();
}
else {
$data["response"] = $this->xmlrpc->display_response();
}
var_dump says $data["response"] is a string(4293)...
I tried var_dump(simplexml_load_string($response));
but I get an error:
Message: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, '<' not found
So how am I supposed to use this response?
xml-rpc is sooo bad documented in the CodeIgniter UserGuide... :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您查看通过 CodeIgniter 的 XML-RPC 类从 Last.fm 返回的实际响应,它看起来像这样:
我希望也许有人可以提供更好的答案,因为这对我来说不是一个最佳解决方案,但似乎工作:
var_dump
应该看起来像这样:If you look at the actual response returned from Last.fm via CodeIgniter's XML-RPC class, it looks like this:
I'm hoping maybe someone can provide a better answer as this doesn't feel like an optimal solution to me but it seems to work:
The
var_dump
should then look something like this: