Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add curl timeout #14

Open
wants to merge 2 commits into from

1 participant

@mmicael

For not blocking a script if Brightcove API is slow to respond

mmicael added some commits
@mmicael mmicael Add curl timeout
For not blocking a script if Brightcove API is slow to respond
9fe9c9b
@mmicael mmicael add attribute timeout fb21d09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 28, 2011
  1. @mmicael

    Add curl timeout

    mmicael authored
    For not blocking a script if Brightcove API is slow to respond
  2. @mmicael

    add attribute timeout

    mmicael authored
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 bc-mapi.php
View
4 bc-mapi.php
@@ -67,6 +67,7 @@ class BCMAPI
private $media_delivery = 'default';
private $secure = FALSE;
private $show_notices = FALSE;
+ private $timeout = 15;
private $timeout_attempts = 100;
private $timeout_current = 0;
private $timeout_delay = 1;
@@ -1353,7 +1354,8 @@ private function curlRequest($request, $get_request = FALSE)
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
}
-
+ // Add curl timeout
+ curl_setopt($curl, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
Something went wrong with that request. Please try again.