Home >Backend Development >PHP Tutorial >Teach you how to use php to achieve remote acquisition of LOL data_PHP tutorial
The website will be online in a few days.
Recently completed a small function, which is LOL data acquisition,
For example: I give you a number, have you ranked this number? What is the combat effectiveness? Get the winning rate and total number of games data
The data can be checked on Duowan’s website, so the function that needs to be done is remote capture.
The function has no highlights, it is just a simple implementation.
Anyway, JS cannot cross domains, and then use PHP to cross domains. It doesn’t matter if you use file_get_content or curl. It is important to understand the business process.
The picture above is the execution business flow chart. Once the process is clear, the code will be easy to write
Of course, here, the focus is on how PHP captures data.
Here we would like to introduce a very good PHP class, Simple_html_dom (get the document from Baidu)
The above code exposes the bug that my English has passed CET-4 but is still flawed.
The above class is very simple. The difficulty lies in how to analyze the data on the Duowan query page. Let’s take a look with firebug.
Write more and you will understand. Of course, if you want to check the rank hidden score, you can do it, but you have to go to Ma Huateng’s website to get the data. I won’t explain it in detail here, just provide an idea