Files
2002-07-22 23:25:05 +00:00

24 lines
790 B
XML

<slide title="cURL with proxies">
<blurb>cURL allows you to go through a proxy in order to make
HTTP requests.</blurb>
<example title="cURL with Proxy" fontsize="1.2em"><![CDATA[<?php
$ch = curl_init ('http://www.playboy.com/');
curl_setopt ($ch, CURLOPT_PROXY, 'http://evil.proxy/');
// curl_setopt ($ch, CURLOPT_PROXY_USERPWD, 'username:pass');
curl_exec ($ch);
curl_close ($ch);
?>]]>
</example>
<blurb>Furthermore, cURL can be used to tunnel all operations through
an HTTP proxy.</blurb>
<example title="Tunnel with cURL" fontsize="1.2em"><![CDATA[<?php
$ch = curl_init ('ftp://ftp.playboy.com/centerfolds/may.jpg');
curl_setopt ($ch, CURLOPT_HTTPPROXY, 'http://127.0.0.1/');
curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_exec ($ch);
curl_close ($ch);
?>]]></example>
</slide>