PHP to implement the simulation login function

Source: Internet
Author: User
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



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.