Proxy not working with Requests::request_multiple()?

I try to send async multiple requests with proxy option by built-in WP Class Requests, but it’s not working.

$options = array(
    'proxy' => $proxy
);

Single Request, it’s working, so the proxy itself is working properly.

$s = Requests::request($link1, array(), array(), 'GET', $options);

The result of var_dump($s):

object(Requests_Response)[1637]
  public 'body' => string '<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for." name="description"><meta content="noodp" name="robots"><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script>(fun'... (length=10134)
  public 'raw' => string 'HTTP/1.1 200 OK
Date: Fri, 17 Feb 2017 12:57:36 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
Content-Encoding: gzip
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Set-Cookie: NID=97=HAyw3oQtHmG8oehIO_MnRpi6jvwmLLwTjkWwOTZYAwa-m2oZfVzTEzqsmYEj-948Hw8HcMMSupEO79HQqUw96cgaYNj0_W_dj2e3w2Jn7C5lwH_xBJjepn5ssg1Ej6KUFJe'... (length=10834)
  public 'headers' => 
    object(Requests_Response_Headers)[1635]

Multiple Requests, not working, always response connection time out error.

 $m = Requests::request_multiple(array(
     array(
         'url' => $link1
         )
 ), $options);

The results of var_dump($m):

array (size=1)
  0 => 
    object(Requests_Exception_Transport_cURL)[1631]
      protected 'code' => int 28
      protected 'type' => string 'cURLEasy' (length=8)
      protected 'reason' => string 'Connection timed out after 10000 milliseconds' (length=45)
      protected 'data' => resource(1426, curl)
      protected 'message' => string '28 Connection timed out after 10000 milliseconds' (length=48)
      private 'string' (Exception) => string '' (length=0)
      protected 'file' => string '/Applications/MAMP/htdocs/wp/wp-includes/Requests/Transport/cURL.php' (length=68)
      protected 'line' => int 241
      private 'trace' (Exception) => 
        array (size=7)
          0 => 
            array (size=6)
              'file' => string '/Applications/MAMP/htdocs/wp/wp-includes/class-requests.php' (length=59)
              'line' => int 480
              'function' => string 'request_multiple' (length=16)
              'class' => string 'Requests_Transport_cURL' (length=23)
              'type' => string '->' (length=2)
              'args' => 
                array (size=2)
                  0 => 
                    array (size=1)
                      0 => 
                        array (size=5)
                          ...
                  1 => 
                    array (size=20)
                      'timeout' => int 10
                      'connect_timeout' => int 10
                      'useragent' => string 'php-requests/1.7' (length=16)
                      'protocol_version' => float 1.1
                      'redirected' => int 0
                      'redirects' => int 10
                      'follow_redirects' => boolean true
                      'blocking' => boolean true
                      'type' => string 'GET' (length=3)
                      'filename' => boolean false
                      'auth' => boolean false
                      'proxy' => string '127.0.0.1:9743' (length=14)
                      'cookies' => boolean false
                      'max_bytes' => boolean false
                      'idn' => boolean true
                      'hooks' => null
                      'transport' => null
                      'verify' => string '/Applications/MAMP/htdocs/wp/wp-includes/certificates/ca-bundle.crt' (length=67)
                      'verifyname' => boolean true
                      'complete' => null

Did I missing anything? Does anyone have any suggestions? Thanks.

0

Leave a Comment