大家好。
PHP and the Curl libraryIt can be easier/cleaner to use the curl library and set the CURLOPT_NETRC option. With that option set,
curl will automatically scan the user's .netrc file for the login/password to the machine being referenced
in the request URL.$url = "http://xxxx.com?Feed=aa&query=ipod&num=10" \\
$c = curl_init($url);
curl_setopt($c, CURLOPT_NETRC, true);
$s = curl_exec($c);
Then the .netrc entry would be:
machine xxxx.com login
feedlogin password feedpw各位,这是什么意思,怎么用?
With that option set,
curl will automatically scan the user's .netrc file for the login/password to the machine being referenced
in the request URL. 这句话什么意思?
PHP and the Curl libraryIt can be easier/cleaner to use the curl library and set the CURLOPT_NETRC option. With that option set,
curl will automatically scan the user's .netrc file for the login/password to the machine being referenced
in the request URL.$url = "http://xxxx.com?Feed=aa&query=ipod&num=10" \\
$c = curl_init($url);
curl_setopt($c, CURLOPT_NETRC, true);
$s = curl_exec($c);
Then the .netrc entry would be:
machine xxxx.com login
feedlogin password feedpw各位,这是什么意思,怎么用?
With that option set,
curl will automatically scan the user's .netrc file for the login/password to the machine being referenced
in the request URL. 这句话什么意思?
machine 机器名or IP
login 登录名
password 密码
machine 机器名or IP
login 登录名
password 密码
是的,怎么登录呢?.netrc 在php中怎么应用呢?
如果是HTTP协议,要知道欲访问的URI是不是HTTP认证的(浏览器弹出对话框的那种),也有的是用POST数据(即网页上的表单);
要根据不同方式编写不同的代码。curl库有一定的保持持续会话的能力,即一些登录数据能保持,直到curl会话结束。
最好有实例,比如你的具体需求是什么。