Regardless of the verification Code, PHP implementation of the simulation login, the method 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. This article mainly introduces the PHP simple 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, hope to help everyone.
1, curl implementation of the code to simulate the 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);//Set whether the returned data is automatically displayed curl_setopt ($ch, Curlopt_returntransfer, 1);//Set 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