search
Homephp教程PHP源码php代理fanqiang

php代理fanqiang

May 25, 2016 pm 05:05 PM

跳至

 array('timeout' => 5, 
	'proxy' => 'tcp://127.0.0.1:8118', 
	'request_fulluri' => True,) 
) 
); 
$result = file_get_contents($url, False, $ctx); 
echo $result; 

/*
//curl 使用
$ci = curl_init(); 
$url = "http://www.youtube.com";
curl_setopt($ci, CURLOPT_HTTPPROXYTUNNEL, TRUE); 
curl_setopt($ci, CURLOPT_PROXY, '127.0.0.1:8118'); 
curl_setopt($ci, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); 
curl_setopt($ci, CURLOPT_URL, $url); 
curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);  
echo "starting...";
$response = curl_exec($ci);
curl_close($ci);
echo "end";
var_dump($response);
*/
?>

                       

           

2. [代码]python代码   

import urllib2
proxy = '127.0.0.1:8118'
url="http://www.youtube.com"
opener = urllib2.build_opener( urllib2.ProxyHandler({'http':proxy}) )
urllib2.install_opener( opener )
sContent = urllib2.urlopen(url).read()
filepath="a.html"
file1=open(filepath,'wb') 
file1.write(sContent) 
file1.close()

           


           

           

3. [代码]curl脚本     

#使用http代理
curl -x 127.0.0.1:8118 -o m1.mp3 http://realaudio.rferl.org/voa/LERE/manual/2013/05/17/1e86b46f-17b6-4988-9ba2-2c3c635c4d3c.mp3

#使用socks5
curl --socks5 127.0.0.1:8888 -o m.mp3 http://realaudio.rferl.org/voa/LERE/manual/2013/05/17/1e86b46f-17b6-4988-9ba2-2c3c635c4d3c.mp3

           


       

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool