PHP获取远程页面输出的xml问题
需要获取一个远程页面输出的xml信息,那个页面除了xml代码以外,页头还有问题其它信息,
用 simplexml_load_string() 去获取这个内容就提示 Entity: line 1: parser error : Start tag expected, '
还有其它办法获取么到这个信息么, 或者直接不用解析xml文件,只要判断里的内容是什么也可以
- XML code
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: application/xml;charset=UTF-8 Content-Length: 662 Date: Wed, 28 Mar 2012 02:04:43 GMT Connection: close <!--?xml version="1.0" encoding="UTF-8" standalone="yes"?--> <error_response> <args> <arg><key>sign</key><value>1B6DF27CC81E98EEBE78F5E4765F2E09</value></arg> <arg><key>timestamp</key><value>20120328100423</value></arg> <arg><key>v</key><value>1.0</value></arg> <arg><key>sign_v</key><value>1</value></arg> <arg><key>method</key><value>allinpay.card.cardwithproductinfo.get</value></arg> <arg><key>app_key</key><value>test</value></arg> <arg><key>format</key><value>xml</value></arg> <arg><key>password</key><value>5arHL6zxgecGKGQ nqBVQPRth3zEuJMO</value></arg> <arg><key>card_id</key><value>12345678</value></arg> </args><code>25</code> <msg>无效签名 </msg> </error_response>
------解决方案--------------------
1、不知道你用什么方法获取的,为什么不去除头信息
2、simplexml_load_file 支持 url,直接取得就可以,为什么要先抓取到字符串
------解决方案--------------------
这样试一下
- PHP code
$string = <args> <arg><key>sign</key><value>1B6DF27CC81E98EEBE78F5E4765F2E09</value></arg> <arg><key>timestamp</key><value>20120328100423</value></arg> <arg><key>v</key><value>1.0</value></arg> <arg><key>sign_v</key><value>1</value></arg> <arg><key>method</key><value>allinpay.card.cardwithproductinfo.get</value></arg> <arg><key>app_key</key><value>test</value></arg> <arg><key>format</key><value>xml</value></arg> <arg><key>password</key><value>5arHL6zxgecGKGQ nqBVQPRth3zEuJMO</value></arg> <arg><key>card_id</key><value>12345678</value></arg> </args><code>25</code> <msg>无效签名 </msg> XML; echo '<pre class="brush:php;toolbar:false">'; $xml = simplexml_load_string($string); var_dump($xml); <br><font color="#e78608">------解决方案--------------------</font><br> 你可以用file_get_contents('aa.xml');然后正则获取。 <div class="clear"> </div>

许多用户在选择智能手表的时候都会选择的华为的品牌,其中华为GT3pro和GT4都是非常热门的选择,不少用户都很好奇华为GT3pro和GT4有什么区别,下面就就给大家介绍一下二者。华为GT3pro和GT4有什么区别一、外观GT4:46mm和41mm,材质是玻璃表镜+不锈钢机身+高分纤维后壳。GT3pro:46.6mm和42.9mm,材质是蓝宝石玻璃表镜+钛金属机身/陶瓷机身+陶瓷后壳二、健康GT4:采用最新的华为Truseen5.5+算法,结果会更加的精准。GT3pro:多了ECG心电图和血管及安

SQL中的Identity是什么,需要具体代码示例在SQL中,Identity是一种用于生成自增数字的特殊数据类型,它常用于唯一标识表中的每一行数据。Identity列通常与主键列配合使用,可以确保每条记录都有一个独一无二的标识符。本文将详细介绍Identity的使用方式以及一些实际的代码示例。Identity的基本使用方式在创建表时,可以使用Identit

一、功能概览键空间通知使得客户端可以通过订阅频道或模式,来接收那些以某种方式改动了Rediskey变化的事件。所有修改key键的命令。所有接收到LPUSHkeyvalue[value…]命令的键。db数据库中所有已过期的键。事件通过Redis的订阅与发布功能(pub/sub)来进行分发,因此所有支持订阅与发布功能的客户端都可以在无须做任何修改的情况下,直接使用键空间通知功能。因为Redis目前的订阅与发布功能采取的是发送即忘(fireandforget)策略,所以如果你的程

为什么截图工具在Windows11上不起作用了解问题的根本原因有助于找到正确的解决方案。以下是截图工具可能无法正常工作的主要原因:对焦助手已打开:这可以防止截图工具打开。应用程序损坏:如果截图工具在启动时崩溃,则可能已损坏。过时的图形驱动程序:不兼容的驱动程序可能会干扰截图工具。来自其他应用程序的干扰:其他正在运行的应用程序可能与截图工具冲突。证书已过期:升级过程中的错误可能会导致此issu简单的解决方案这些适合大多数用户,不需要任何特殊的技术知识。1.更新窗口和Microsoft应用商店应用程

An unpatchable Yubico two-factor authentication key vulnerability has broken the security of most Yubikey 5, Security Key, and YubiHSM 2FA devices. The Feitian A22 JavaCard and other devices using Infineon SLB96xx series TPMs are also vulnerable.All

遇到的问题:在开发过程中,会遇到要批量删除某种规则的key,例如login_logID(ID为变量),现在需要删除"login_log*"这一类的数据,但是redis本身只有批量查询一类key值的命令keys,但是没有批量删除某一个类的命令。解决办法:先查询,在删除,使用xargs传参(xargs可以将管道或标准输入(stdin)数据转换成命令行参数),先执行查询语句,在将查询出来的key值,当初del的参数去删除。redis-cliKEYSkey*(查找条件)|xargsr

第1部分:初始故障排除步骤检查苹果的系统状态:在深入研究复杂的解决方案之前,让我们从基础知识开始。问题可能不在于您的设备;苹果的服务器可能会关闭。访问Apple的系统状态页面,查看AppStore是否正常工作。如果有问题,您所能做的就是等待Apple修复它。检查您的互联网连接:确保您拥有稳定的互联网连接,因为“无法连接到AppStore”问题有时可归因于连接不良。尝试在Wi-Fi和移动数据之间切换或重置网络设置(“常规”>“重置”>“重置网络设置”>设置)。更新您的iOS版本:

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code<form name="myform"


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),