diff --git a/src/Thomaswelton/LaravelFacebook/Facebook.php b/src/Thomaswelton/LaravelFacebook/Facebook.php index fd1dd8c..b31fa38 100644 --- a/src/Thomaswelton/LaravelFacebook/Facebook.php +++ b/src/Thomaswelton/LaravelFacebook/Facebook.php @@ -11,6 +11,10 @@ function __construct(){ 'appId' => Config::get('laravel-facebook::appId'), 'secret' => Config::get('laravel-facebook::secret') ); + + if (Config::has('laravel-facebook::proxy')) { + $this->setProxy(Config::get('laravel-facebook::proxy'), Config::get('laravel-facebook::proxy_auth', null)); + } parent::__construct($config); } @@ -30,7 +34,19 @@ public function getSignedRequest($useSession = true){ } } + + /** + * Sets the proxy + * $proxy = 'host:port'; + */ + public function setProxy($proxy, $auth = null) { + self::$CURL_OPTS[CURLOPT_PROXY] = $proxy; + if ($auth !== null) { + self::$CURL_OPTS[CURLOPT_PROXYUSERPWD] = $auth['user'] . ':' . $auth['pass']; + } + } + /** * Checks to see if the user has "liked" the page by checking a signed request * @return int -1 don't know, 0 doesn't like, 1 liked