Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //THIS IS A TEST
- $ch = curl_init('http://www.google.com');
- curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1');
- curl_setopt($ch, CURLOPT_PROXY, '114.80.136.112:7780');
- curl_setopt($ch, CURLOPT_TIMEOUT, 40);
- curl_exec($ch);
- echo curl_error($ch);
- print_r(curl_getinfo($ch));
- curl_close($ch);
- ?>
- <?php
- //THIS IS A TEST
- $ch = curl_init('http://www.google.com');
- $f = fopen('requests.txt', 'w');
- curl_setopt_array($ch, array(
- CURLOPT_PROXY => '114.80.136.112:7780',
- CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
- CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1',
- CURLOPT_TIMEOUT => 40,
- CURLOPT_VERBOSE => 1,
- CURLOPT_STDERR => $f,
- ));
- curl_exec($ch);
- fclose($f);
- echo curl_error($ch);
- print_r(curl_getinfo($ch));
- curl_close($ch);
- ?>
- * About to connect() to proxy 114.80.136.112 port 7780 (#0)
- * Trying 114.80.136.112...
- * Timeout
- * connect() timed out!
- * Closing connection #0
- <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
- <TITLE>302 Moved</TITLE></HEAD><BODY>
- <H1>302 Moved</H1>
- The document has moved
- <A HREF="http://www.google.com.hk/url?sa=p&hl=zh-CN&pref=hkredirect&pval=yes&q=http://www.google.com.hk/&ust=1373746017821152&usg=AFQjCNG2MqAeEfu9C9h5dmJu1n0YZWm5vw">here</A>.
- </BODY></HTML>
- Array
- (
- [url] => http://www.google.com
- [content_type] => text/html; charset=UTF-8
- [http_code] => 302
- [header_size] => 580
- [request_size] => 191
- [filetime] => -1
- [ssl_verify_result] => 0
- [redirect_count] => 0
- [total_time] => 0.733
- [namelookup_time] => 0
- [connect_time] => 0.328
- [pretransfer_time] => 0.328
- [size_upload] => 0
- [size_download] => 376
- [speed_download] => 512
- [speed_upload] => 0
- [download_content_length] => 376
- [upload_content_length] => 0
- [starttransfer_time] => 0.733
- [redirect_time] => 0
- [certinfo] => Array
- (
- )
- [redirect_url] => http://www.google.com.hk/url?sa=p&hl=zh-CN&pref=hkredirect&pval=yes&q=http://www.google.com.hk/&ust=1373746017821152&usg=AFQjCNG2MqAeEfu9C9h5dmJu1n0YZWm5vw
- )
- curl_setopt( $curl_handle, CURLOPT_PROXY, '127.0.0.1:9050' );
- curl_setopt( $curl_handle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement