Is there something in php equivalent to CookieContainer in Asp. Net?

Source: Internet
Author: User
Is there something in php equivalent to CookieContainer in Asp. Net? In Asp. Net, the following functions can be used to access the page. postData is the data that requires the Post of the specified url:

Public string getHtml (string url, CookieContainer cookie, byte [] postData );



How to implement it in php? Can it be written like this?
 


Are there any of the following statements?
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ tmpFile );
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, $ tmpFile );

Can only use temporary files? Are there other improvement methods? O (∩ _ ∩) O thank you ~~~~~~


Reply to discussion (solution)

CURLOPT_COOKIEJAR is used to save the cookie to the file when the connection is closed.
CURLOPT_COOKIEFILE is used to send the cookie in the file during connection.
CURLOPT_COOKIE is used to send the cookie in the variable during connection.
Whether it is required or not depends on your application scenario.

Save to file is the default action
You can set CURLOPT_READFUNCTION to process it with your own function.

Thank you for your guidance ~~~

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.