To obtain the xml output from a remote page, PHP needs to obtain the xml output from a remote page. in addition to the xml code, the page header has other problematic information. use simplexml_load_string () if you get this content, the error message "Entity: line1: parsererror: Starttage PHP" is used to obtain the xml output from the remote page.
You need to obtain the xml output from a remote page. besides the xml code, the page header has other problems,
If simplexml_load_string () is used to obtain this content, the system prompts Entity: line 1: parser error: Start tag expected, '<' not found
Is there any other way to get this information, or you don't need to parse the xml file, as long as you determine
The content in can also be
XML code
HTTP/1.1 200 OKServer: Apache-Coyote/1.1Content-Type: application/xml; charset = UTF-8Content-Length: 662 Date: Wed, 28 Mar 2012 02:04:43 GMTConnection: close
Sign
1B6DF27CC81E98EEBE78F5E4765F2E09
Timestamp
20120328100423
V
1.0
Sign_v
1
Method
Allinpay. card. cardwithproductinfo. get
App_key
Test
Format
Xml
Password
5arHL6zxgecGKGQ nqBVQPRth3zEuJMO
Card_id
12345678
25
Invalid signature
------ Solution --------------------
1. I don't know what method you used to obtain it. why don't I remove the header information?
2. simplexml_load_file supports URLs and can be obtained directly. why should we capture strings first?
------ Solution --------------------
Try it now.
PHP code
$ String = <
Sign
1B6DF27CC81E98EEBE78F5E4765F2E09
Timestamp
20120328100423
V
1.0
Sign_v
1
Method
Allinpay. card. cardwithproductinfo. get
App_key
Test
Format
Xml
Password
5arHL6zxgecGKGQ nqBVQPRth3zEuJMO
Card_id
12345678
25
Invalid signature
XML; echo'
'; $ Xml = simplexml_load_string ($ string); var_dump ($ xml );
------ Solution --------------------
You can use file_get_contents ('AA. XML'); then obtain the regular expression.