PHP cURL to achieve simulation login and collection method of use

time:17-06-29 forum:PHP tools and code
  http://www.zjmainstay.cn/php-curl

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
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

prev:PHP curl function simulated crawler (ope... next:Advantages and disadvantages of cURL, fi...
post comment
Notice



approved   The family photo played by their par...   The universal Handbook of life in Ji...   Dr. doctorate: two hands earn money ...   Visiting group of pregnant women wit...   She was 10 years old as a babysitter...
rand   Talk about 10 MySQL mistakes that PH...   10 MySQL errors that PHP developers ...   Eliminate 3 Chinese characters from ...   Importing large databases to virtual...   Using regular expressions to verify ...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com