Fix for allowing Proxy Support
-
Hi all,
I’ve never been able to get the Fetch Tweets plugin to respect the WordPress proxy settings. I’ve discovered that it’s due to the twitteroauth library manually using direct calls to curl in order to make the requests. After the tweets are cached though, it uses the wp_remote_get commands (which respect the proxy configuration in WordPress) to retrieve the data..
I’ve made a modification to in include\library\TwitterOAuth\twitteroauth.php that is a copy-paste from class-http.php with a few changes. I’ve added it right underneath line 205 (which is curl_setopt($ci, CURLOPT_HEADER, FALSE); )
$proxy = new WP_HTTP_Proxy(); if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { curl_setopt( $ci, CURLOPT_PROXYTYPE, CURLPROXY_HTTP ); curl_setopt( $ci, CURLOPT_PROXY, $proxy->host() ); curl_setopt( $ci, CURLOPT_PROXYPORT, $proxy->port() ); if ( $proxy->use_authentication() ) { curl_setopt( $ci, CURLOPT_PROXYAUTH, CURLAUTH_ANY ); curl_setopt( $ci, CURLOPT_PROXYUSERPWD, $proxy->authentication() ); } }
Ever since adding this, I’ve been able to retrieve tweets on a server that’s behind a firewall without any crazy extra work.
Please integrate this into the next release :).
Regards,
snickler.EDIT: I just found the git-hub repo.. I’ll just make a pull request for it.
- The topic ‘Fix for allowing Proxy Support’ is closed to new replies.