Php obtains the source code of the entire page.

Source: Internet
Author: User
Php retrieves the entire page instance. first use $ _ SVERVER to obtain the address before the jump page. use the crul function to obtain the entire page.

Php gets the entire page instance. first use $ _ SVERVER to get the address before the jump to the page. use the crul function to get the whole page:

The code is as follows:

PHP code
  1. $ Cookie_jar = tempnam ('./tmp', 'cooker ');
  2. // Initialize curl
  3. $ Ch = curl_init () or die (curl_error ());
  4. $ Title = $ _ POST [title];
  5. Print_r ($ title );
  6. // Set URL parameters
  7. Curl_setopt ($ ch, CURLOPT_URL, "$ _ SERVER [HTTP_REFERER]");
  8. Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ title );
  9. // Save the returned cookie information in the $ cookie_jar file.
  10. Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookie_jar );
  11. Print_r ($ _ cookie );
  12. // Request that CURL return data
  13. Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
  14. // Execute the request
  15. $ Result = curl_exec ($ ch) or die (curl_error ());
  16. // Obtain the returned result and display it
  17. Echo $ result;
  18. Echo curl_error ($ ch );
  19. // Disable CURL
  20. Curl_close ($ ch );
  21. ?>

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.