Title: Proxy support
Last modified: August 31, 2016

---

# Proxy support

 *  Resolved [Dick Visser](https://wordpress.org/support/users/usrlocaldick/)
 * (@usrlocaldick)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/proxy-support-1/)
 * Hi
 * I’ve noticed that this plugin does not support HTTP proxies such as Squid.
    In
   restricted environments with limited outgoing connectivity this is a problem 
   because the plugin doesn’t work. Moreover if the outgoing traffic to https:/graphs.
   facebook.com is silently dropped by a firewall it will additionally cause a very
   slow site because the connections make the page hang. Attached is a patch for
   version 2.4 that adds proxy support by means of picking up the settings that 
   people have in their wp-config.php.
 *     ```
       --- custom-facebook-feed.php	2016-04-08 16:19:14.000000000 +0200
       +++ custom-facebook-feed.proxy-ok.php	2016-04-08 16:19:52.000000000 +0200
       @@ -1548,6 +1548,20 @@
                //Use cURL
                if(is_callable('curl_init')){
                    $ch = curl_init();
       +            // Use global proxy settings
       +            if (defined('WP_PROXY_HOST')) {
       +              curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
       +            }
       +            if (defined('WP_PROXY_PORT')) {
       +              curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
       +            }
       +            if (defined('WP_PROXY_USERNAME')){
       +              $auth = WP_PROXY_USERNAME;
       +              if (defined('WP_PROXY_PASSWORD')){
       +                $auth .= ':' . WP_PROXY_PASSWORD;
       +              }
       +              curl_setopt($ch, CURLOPT_PROXYUSERPWD, $auth);
       +            }
                    curl_setopt($ch, CURLOPT_URL, $url);
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($ch, CURLOPT_TIMEOUT, 20);
       @@ -1575,6 +1589,20 @@
                //Auto detect
                if(is_callable('curl_init')){
                    $ch = curl_init();
       +            // Use global proxy settings
       +            if (defined('WP_PROXY_HOST')) {
       +              curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
       +            }
       +            if (defined('WP_PROXY_PORT')) {
       +              curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
       +            }
       +            if (defined('WP_PROXY_USERNAME')){
       +              $auth = WP_PROXY_USERNAME;
       +              if (defined('WP_PROXY_PASSWORD')){
       +                $auth .= ':' . WP_PROXY_PASSWORD;
       +              }
       +              curl_setopt($ch, CURLOPT_PROXYUSERPWD, $auth);
       +            }
                    curl_setopt($ch, CURLOPT_URL, $url);
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                    curl_setopt($ch, CURLOPT_TIMEOUT, 20);
       ```
   
 * [https://wordpress.org/plugins/custom-facebook-feed/](https://wordpress.org/plugins/custom-facebook-feed/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [smashballoon](https://wordpress.org/support/users/smashballoon/)
 * (@smashballoon)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/proxy-support-1/#post-7253687)
 * Hey [@usrlocaldick](https://wordpress.org/support/users/usrlocaldick/),
 * Thanks for the patch. I’ll test it out and should be able to add it into the 
   next update. Just to let you know, you can switch the method that the plugin 
   uses to make the Facebook API request to be the WordPress WP_HTTP class, which
   I believe includes support for wp-config proxy settings. You can change the request
   method by using the following setting:
 * _Facebook Feed > Customize > Misc > Misc Settings > **Request Method**_
 * Thanks again, I appreciate you reporting the issue.
 * John
 *  Thread Starter [Dick Visser](https://wordpress.org/support/users/usrlocaldick/)
 * (@usrlocaldick)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/proxy-support-1/#post-7253721)
 * Aha. I didn’t spot that option.
    If that is the case then the patch shouldn;t
   be needed – i’ll test it out. If it works with WP_Http then I think the WP_Http
   request method should be the default.
 * Thanks
 *  Plugin Author [smashballoon](https://wordpress.org/support/users/smashballoon/)
 * (@smashballoon)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/proxy-support-1/#post-7253759)
 * No probs. I actually released an update yesterday and included your patch in 
   it, so if you update it should fix the issue for you 🙂
 * Thanks again, and I hope you’re having a good weekend!
 * John

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Proxy support’ is closed to new replies.

 * ![](https://ps.w.org/custom-facebook-feed/assets/icon-256x256.png?rev=2700775)
 * [Smash Balloon Social Post Feed - Simple Social Feeds for WordPress](https://wordpress.org/plugins/custom-facebook-feed/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-facebook-feed/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-facebook-feed/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-facebook-feed/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-facebook-feed/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-facebook-feed/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [smashballoon](https://wordpress.org/support/users/smashballoon/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/proxy-support-1/#post-7253759)
 * Status: resolved