如何在xml文件中获取动态IP? [英] How to get dynamic ip in xml file?

查看:398
本文介绍了如何在xml文件中获取动态IP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有'links.xml'文件,它包含URL,该URL用于执行即时搜索并查找该URL指定的特定页面.

I have 'links.xml' file it contains url's which is used to perform instant search and go for the particular page specified by the url.

"links.xml"源

'links.xml' source

<?xml version="1.0" encoding="utf-8"?>
<!-- Edited by XMLSpy -->
<pages>

<link>
<title>Advanced</title>
<url>http://{192.168.44.128}/reboot.php</url>
</link>

<link>
<title>Manager</title>
<url>http://{192.168.44.128}/manager.php</url>
</link>

<link>
<title>Firmware</title>
<url>http://{192.168.44.128}/system.php</url>
</link>

<link>
<title>States</title>
<url>http://{192.168.44.128}/states.php</url>
</link>
</pages>

在上面的代码中:{192.168.44.128} = 192.168.44.128 (如果没有大括号,我无法发布问题.)

In above code: {192.168.44.128}=192.168.44.128 (I couldn't post the question without the braces.)

我想在url标记中发送动态IP地址,因为IP地址不断变化,而不是静态IP.除了这个文件,我还使用了php和html文件.那么可以仅在xml文件中提供动态地址而不对其他文件进行任何更改吗?如果是,那怎么办?如果没有,那么如何在url标签中发送动态IP地址.

I want to send dynamic IP address in the url tag because IP address keeps changing and its not static IP. Along with this file I have used a php and a html file. So can dynamic address be provided in xml file only without making any changes to other files? If yes, then how? If not, then how to send dynamic IP address in the url tag.

此代码取自: http://www.w3schools.com/php/php_ajax_livesearch.asp

致谢.

推荐答案

您可以使用MIME类型更改输出. 只需创建一个php文件,并使用它来显示动态IP地址. 使用header('Content-type: application/xml');将其作为XML发送.

You can use MIME types to change the output. Just create a php file and use it to display dynamic ip adresses. Use header('Content-type: application/xml'); to send it as XML.

但是,如果使用它来显示原始xml数据,请使用text/xml而不是application/xml.

However if you use it to display raw xml data use text/xml instead of application/xml.

这篇关于如何在xml文件中获取动态IP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆