介绍:PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP's ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication. These functions have been added in PHP 4.0.2.
需求
In order to use the CURL functions you need to install the CURL package. PHP requires that you use CURL 7.0.2-beta or higher. PHP will not work with any version of CURL below version 7.0.2-beta. From PHP version 4.2.3 you will atleast need CURL version 7.9.0 or higher. 例子 1. Using PHP's CURL module to fetch the example.com homepage
<?php$ch = curl_init ("http://www.example.com/");
$fp = fopen ("example_homepage.txt", "w");curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);curl_exec ($ch);
curl_close ($ch);
fclose ($fp);
?>
需求
In order to use the CURL functions you need to install the CURL package. PHP requires that you use CURL 7.0.2-beta or higher. PHP will not work with any version of CURL below version 7.0.2-beta. From PHP version 4.2.3 you will atleast need CURL version 7.9.0 or higher. 例子 1. Using PHP's CURL module to fetch the example.com homepage
<?php$ch = curl_init ("http://www.example.com/");
$fp = fopen ("example_homepage.txt", "w");curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);curl_exec ($ch);
curl_close ($ch);
fclose ($fp);
?>
好像不能。
up,没有用过.
up,没有用过.
$URL="www.mysite.com/test.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://$URL");
我实在不想重装系统!因服务器不在本地!要是各位大侠都无此经验,那就只好重装系统了!期待着高手的出现!
<?
$ch = curl_init();echo "asdfsadsadd$ch<br>";//$test1="http://www.hkever.com/newct/letget.php";$test2="https://www.hkever.com/newct/letget.php"; echo $PostData."<br>";curl_setopt($ch,CURLOPT_URL,$test2);//curl_setopt($ch,CURLOPT_URL,$test1);echo "set postdata OK!<br>";curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);echo " set returntrasfer ok!<br>";curl_setopt($ch, CURLOPT_TIMEOUT,30);echo "set time out ok!<br>";$result=curl_exec($ch);echo "result is :".$result;echo "excute ok!<br>";curl_close($ch);echo "close curl OK!<br>";phpinfo();
?>当我用到https的URL时,浏览器就会提示什么DNS错误!