It is known that the APIphp of No. 1 stores has APIs for sending http requests and obtaining the returned XML for guidance. it is OK according to the interface specifications. the methods generally include: file_get_contents, curl, which method does fsockopen use? depends on your API and the specific environment in which you know the API of No. 1 store. how does php send an http request and obtain the returned XML?
Please advise
------ Solution --------------------
If all the APIs are available, it will be okay according to the interface specifications.
Methods generally include: file_get_contents, curl, and fsockopen.
Which one to choose depends on your API and specific environment?
Your problem description is almost 0, which is not a good way to ask questions.
------ Solution --------------------
JScript code
Script // Ajaxvar xmlHttp; function createXMLHttpRequest () {if (window. XMLHttpRequest) {xmlHttp = new XMLHttpRequest ();} else if (window. activeXObject) {xmlHttp = new ActiveXObject ("Microsoft. XMLHTTP ") ;}} createXMLHttpRequest (); // API url =" xxx. php? Param = "+ param +" & ran = "+ Math. random (); method = "GET"; xmlHttp. open (method, url, true); xmlHttp. onreadystatechange = show; xmlHttp. send (null);} function show () {if (xmlHttp. readyState = 4) {if (xmlHttp. status = 200) {var text = xmlHttp. responseText; alert ("xml -->" + text); // document. getElementById ("s2 "). innerHTML = text;} else {alert ("response error code:" + xmlHttp. status) ;}} script
------ Solution --------------------
Discussion
Reference:
If all the APIs are available, it will be okay according to the interface specifications.
Methods generally include: file_get_contents, curl, and fsockopen.
Which one to choose depends on your API and specific environment?
Your problem description is almost 0, which is not a good way to ask questions.
Well, the value returned by their API is file_get_contents of xml. the Function reads the content.
------ Solution --------------------
Now that all the content is available, you can study the rest of the process by yourself.
Php parses xml
Believe in yourself, no problem
------ Solution --------------------
Discussion
Reference:
Isn't that what we get? What else do you want?
I want to get XML, which only contains content. let's see how to read the tag.
------ Solution --------------------
Discussion
Reference:
Reference:
Isn't that what we get? What else do you want?
I want to get XML, which only contains content. let's see how to read the tag.
Yes
These should also be read out. all the code returns are content numbers.
------ Solution --------------------
Use simplexml to parse the data into an array. the key of the array is the tag you want.
------ Solution --------------------
Domdocument and simplexml are both official libraries. write a function to recursively traverse it.