Similar to dreamhost such as host service providers, is to display the use of fopen. Use of PHP's curl can be implemented to support FTP, FTPS, HTTP htpps SCP SFTP TFTP, TELNET DICT file and LDAP. Curl supports SSL certificates, HTTP POST, http PUT, FTP uploads, Kerberos, HTT-based uploads, proxies, cookies, user + password proofs, file transfer recovery, HTTP proxy channels for the most common use, is an HTTP-based get and post method.
Code implementation:
1. Get implementation of HTTP
The following is the referenced content: $ch = Curl_init ("http://www.webjx.com/"); curl_setopt ($ch, Curlopt_returntransfer, true); curl_setopt ($ch, Curlopt_binarytransfer, true); $output = curl_exec ($ch); $fh = fopen ("out.html", ' W '); Fwrite ($FH, $output); Fclose ($FH); |
2, the HTTP POST implementation
//extract data from the post Extract ($_post); //set POST variables $url = ' http://www.webjx.com/get-post.php '; $fields = Array ( ' lname ' =>urlencode ($last _name), ' fname ' =>urlencode ($first _name), ' title ' = >urlencode ($title), ' Company ' =>urlencode ($institution), ' age ' =>urlencode ($age), ' email ' = UrlEncode ($email), ' phone ' =>urlencode ($phone) ); //url-ify The data for the POST foreach ($fields as $key = = $value) {$fields _string. = $key. ' = '. $value. ' & '; } RTrim ($fields _string, ' & '); //open connection $ch = Curl_init (); //set the URL, number of post VARs, post data curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, Curlopt_post,count ($fields)); curl_setopt ($ch, Curlopt_postfields, $fields _string); //execute post $result = curl_exec ($ch); //close Connection Curl_close ($ch); |
http://www.bkjia.com/PHPjc/364043.html www.bkjia.com true http://www.bkjia.com/PHPjc/364043.html techarticle similar to dreamhost such as host service providers, is to display the use of fopen. Use of PHP's curl can be implemented to support FTP, FTPS, HTTP htpps SCP SFTP TFTP, TELNET DICT file and LDAP. Curl Support S ...