PHP Curl operation

Source: Internet
Author: User

<?PHP//$curl =curl_init ();//$url = "HTTP://LOCALHOST/CC/GET.PHP?LO=CCC";//Curl_setopt ($curl, Curlopt_url, $url);//Curl _exec ($curl);//Curl_close ($curl); $curl=curl_init ();$url= "http://localhost/cc/post.php"; curl_setopt ($curl, Curlopt_url,$url); curl_setopt ($curl, Curlopt_post,true);//change to post transfer $post _data=Array(' username ' = ' admin ', ' pwd ' = ' admin888 ', ' captcha ' = ' qqq ', ' logo ' = ' @c:/users/administrator/desktop/') Www.png ');//before the file name, add @, tell the server, this is the filecurl_setopt ($curl, Curlopt_postfields,$post _data);//put in transfer data//If you want to implement session or cookies, set save Cookies//curl_setopt ($curl, Curlopt_cookiejar, "./xx.txt");// The second time you use session or cookies, use the following//curl_setopt ($curl, Curlopt_cookiefile, "./xx.txt");curl_setopt ($curl, Curlopt_returntransfer,true);//If you don't add this, it will output directly .$rs=curl_exec ($curl); Curl_close ($curl);?>
<? PHP Session_Start (); Echo $_session ["A"]= "asdf"; // echo $_post["username"];//var_dump ($_files);//Move_uploaded_file ($_files[' logo ' [' Tmp_name '], './p.jpg ');// echo "Upload success";? >

PHP Curl operation

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.