PHP cURL to achieve simulation login and collection method of use
tool
Firefox browser (FireFox). Before analyzing the case, let's learn how to use the artifact Firebug to get the necessary information.
use F12 to open Firebug, we can get the interface:
Firebug
arrow icon is the "element selection" tool, click to highlight the icon, and the movement of the mouse in the page will select the corresponding content in the HTML menu at the same time, then click the content to indicate that this The element, the icon is highlighted and canceled. As shown in figure (two), the print of the console.log series function in the
Firebug view element
console
JS is output here.
HTML
HTML content, notice that what you see here is not necessarily the content to be collected, the analysis of the content when collecting, all in order to view the source code (Ctrl U), here only can quickly locate the structure of the element, and then choose a more special reference, and locate the corresponding position in the source code.
for example, you see in HTML a label is.Lt; div id=.quot; demo.quot; class=.quot; demo.quot;.Gt; Demo.lt; /div.gt; but you see the source when you look at the source. Then match, then you can't get the result.
CSS
CSS file content
script
Javascript file content
DOM
Dom node content
network
data for each request link. Here is where we collect attention and analysis, it can display the parameters of each request, please Ask for head, Cookie data and so on. When the page submission is refreshed, it needs to be kept so that the page request content remains in the console after the refresh, as shown in figure (three):
Firebug network maintains
, Firefox and a Tamper data extension can also get the requested data, so it can be installed and used.
Cookies
Cookie data
in the figure (1) also see that there are a number of optional small menu items, in which we are concerned, when choosing it, even if the submission form refreshes the page, The data in the content area will still be retained, which is particularly critical for analyzing submitted data.
sum up
when we analyze collection requests, we are mainly concerned with the request data in the "network" menu, and use "keep" to view the request data of the refresh page when necessary, and the following content can be cleared before the request.
project address https://github.com/Zjmainstay/php-curl