<?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