This article mainly introduces the PHP implementation of the simulation landing function, involving PHP using curl to achieve the simulation landing of the relevant operation skills, the need for friends can refer to the following
Specific as follows:
Regardless of the verification Code, PHP implementation of the simulation landing, the method of the Internet is generally used to simulate the implementation of curl, but curl is the server-side and server-side set up a session, can only simulate the landing after the landing data, The cookie information cannot be planted on the client (at least for the moment I find no way to find it) and finally by the hidden IFrame.
1, curl implementation of the code to login, (just to implement the server and the server to establish a session, in fact, there is no session between the client and the server)
<?php$cookie_jar = Tempnam ('./tmp ', ' Cookie '); $ch = Curl_init (); curl_setopt ($ch, Curlopt_url, ' http://192.168.0.22 /logincheck.php '); curl_setopt ($ch, Curlopt_post, 1); $request = ' uname=admin&password=123456 '; curl_setopt ($ch, Curlopt_postfields, $request);//Save the returned cookie information in the $cookie_jar file curl_setopt ($ch, Curlopt_cookiejar, $cookie _jar);// Sets whether the returned data automatically displays curl_setopt ($ch, Curlopt_returntransfer, 1);//sets whether to display header information curl_setopt ($ch, Curlopt_header, false);// Sets whether to output page content curl_setopt ($ch, Curlopt_nobody, false); curl_exec ($ch); Curl_close ($ch);//get data after login$ch2 = Curl_ Init (); curl_setopt ($ch 2, Curlopt_url, ' http://192.168.0.22/general/'); curl_setopt ($ch 2, Curlopt_header, false); curl_setopt ($ch 2, Curlopt_returntransfer, 1); curl_setopt ($ch 2, Curlopt_cookiefile, $cookie _jar); $orders = Curl_exec ( $ch 2); echo $orders; Exit;echo ' <pre> '; Echo strip_tags ($orders); Echo ' </pre> '; Curl_close ($ch 2);? >
2, through the hidden IFRAME to achieve client-server communication (Ken can bring a certain security risks)
ceshi1.php
Related recommendations:
Example of implementation of the PHP simulation login feature
PHP Simulation Landing Crawl page content curl how to use
PHP Simulation login MSN and get user Information _php tutorial