Home  >  Article  >  php教程  >  PHP中让curl支持sock5的代码实例

PHP中让curl支持sock5的代码实例

WBOY
WBOYOriginal
2016-06-06 20:13:241084browse

这篇文章主要介绍了PHP中让curl支持sock5的代码实例,本文直接给出实现代码,需要的朋友可以参考下

复制代码 代码如下:


//最近需要用到curl测试代理是否可用,代理是sock5非http的 所以需要在curl中增加几句。 
 
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); 
curl_setopt($ch, CURLOPT_PROXY, "0.0.0.0:8080"); 
curl_setopt($ch,CURLOPT_PROXYUSERPWD, "username:pwd"); 
 
//测试ok 速度很快 哈哈 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP操作码(opcode)底层原理Next article:jshint设置