我需要的是一种方法来引入这个: 184.173.18.228/api/profile/1000/0/Adam.Adams (这是一个xml文件)到php (我假设)中使用Joomla (我可以使用Sourcerer在Joomla中的代码)-我遇到的问题是有一个跨域代理问题-上周末我能够使用ajax/jquery在我的机器上呈现该xml:
// jQuery script
$(function() {
// Load data from proxy.php using GET request
$.get('test.xml', function(data)
{
// Search for the XML element you want, perform an action on each occurrence of found element
$(data).find("XMLElement").each(function()
{
$('#output').append($(this).attr('XMLAttribute')); // Display desired attribute of element -OR-
$('#output').append($(this).children("Phone").text());我甚至不确定我问的问题是否正确--我希望发生的是:一个php脚本来引入xml/url来回显/填充页面上的html。我试了无数次,但就是不能成功
发布于 2013-01-28 06:58:52
这看起来真的像Javascript,而不是php。在php中,你不会有跨域的限制,因为它是在服务器上运行的,而不是在浏览器上。
所有浏览器都将阻止跨域ajax调用。
您的解决方案是在php中编写一个脚本,对远程站点执行wget或curl,这样您调用本地脚本,服务器上的脚本就会加载远程url。你应该能找到一些现成的。
https://stackoverflow.com/questions/14529869
复制相似问题