Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Add option to use HTTP proxy for requests #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ The constructor for the BCMAPI class.

Type: Integer

- **proxy** *Public - HTTP Proxy to use for connecting to Brightcove services.*

Type: String

- **secure** *Private - Whether BCMAPI is operating over HTTPS*

Type: Boolean
Expand Down
5 changes: 5 additions & 0 deletions bc-mapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class BCMAPI
private $api_calls = 0;
private $bit32 = FALSE;
private $media_delivery = 'default';
private $proxy = NULL;
private $secure = FALSE;
private $show_notices = FALSE;
private $timeout_attempts = 100;
Expand Down Expand Up @@ -1358,6 +1359,10 @@ private function curlRequest($request, $get_request = FALSE)
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
}
if(!is_null($this->proxy))
{
curl_setopt($curl, CURLOPT_PROXY, $this->proxy);
}

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
Expand Down