Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 27th, 2013  |  syntax: None  |  size: 2.28 KB  |  views: 282  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. //THIS IS A TEST
  4. $ch = curl_init('http://www.google.com');
  5. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1');
  6. curl_setopt($ch, CURLOPT_PROXY, '114.80.136.112:7780');
  7. curl_setopt($ch, CURLOPT_TIMEOUT, 40);
  8. curl_exec($ch);
  9. echo curl_error($ch);
  10. print_r(curl_getinfo($ch));
  11. curl_close($ch);
  12.  
  13. ?>
  14.        
  15. <?php
  16.  
  17. //THIS IS A TEST
  18. $ch = curl_init('http://www.google.com');
  19.  
  20. $f = fopen('requests.txt', 'w');
  21.  
  22. curl_setopt_array($ch, array(
  23.     CURLOPT_PROXY => '114.80.136.112:7780',
  24.     CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
  25.     CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1',
  26.     CURLOPT_TIMEOUT => 40,
  27.     CURLOPT_VERBOSE        => 1,
  28.     CURLOPT_STDERR         => $f,
  29. ));
  30.  
  31. curl_exec($ch);
  32. fclose($f);
  33. echo curl_error($ch);
  34. print_r(curl_getinfo($ch));
  35. curl_close($ch);
  36.  
  37. ?>
  38.        
  39. * About to connect() to proxy 114.80.136.112 port 7780 (#0)
  40. *   Trying 114.80.136.112...
  41. * Timeout
  42. * connect() timed out!
  43. * Closing connection #0
  44.        
  45. <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
  46. <TITLE>302 Moved</TITLE></HEAD><BODY>
  47. <H1>302 Moved</H1>
  48. The document has moved
  49. <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>.
  50. </BODY></HTML>
  51. Array
  52. (
  53.     [url] => http://www.google.com
  54.     [content_type] => text/html; charset=UTF-8
  55.     [http_code] => 302
  56.     [header_size] => 580
  57.     [request_size] => 191
  58.     [filetime] => -1
  59.     [ssl_verify_result] => 0
  60.     [redirect_count] => 0
  61.     [total_time] => 0.733
  62.     [namelookup_time] => 0
  63.     [connect_time] => 0.328
  64.     [pretransfer_time] => 0.328
  65.     [size_upload] => 0
  66.     [size_download] => 376
  67.     [speed_download] => 512
  68.     [speed_upload] => 0
  69.     [download_content_length] => 376
  70.     [upload_content_length] => 0
  71.     [starttransfer_time] => 0.733
  72.     [redirect_time] => 0
  73.     [certinfo] => Array
  74.         (
  75.         )
  76.  
  77.     [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
  78. )
  79.        
  80. curl_setopt( $curl_handle, CURLOPT_PROXY, '127.0.0.1:9050' );
  81. curl_setopt( $curl_handle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5 );