Skip to content

Commit

Permalink
Closed curl handles and refined endpoint check
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerd Naschenweng committed May 30, 2016
1 parent 8b4ec2b commit 0a8eaf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions providers/bounce-provider-interspire.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ function Interspire_getLists() {
curl_setopt($ch, CURLOPT_TIMEOUT, ENDPOINT_TIMEOUT);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = curl_exec($ch);
curl_close ($ch);

if ($result === false || is_null($result) || empty($result)) {
$log->lwrite(' Interspire: Can not access Interspire to get Interspire Lists!');
Expand Down Expand Up @@ -144,6 +145,7 @@ function Interspire_postXMLData($xml) {
curl_setopt($ch, CURLOPT_TIMEOUT, ENDPOINT_TIMEOUT);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = curl_exec($ch);
curl_close ($ch);

if ($result === false || is_null($result) || empty($result))
return null;
Expand Down Expand Up @@ -179,6 +181,8 @@ function Interspire_getAllListsForEmailAddress($email) {
curl_setopt($ch, CURLOPT_TIMEOUT, ENDPOINT_TIMEOUT);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
$result = curl_exec($ch);
curl_close ($ch);

if ($result === false || is_null($result) || empty($result))
return null;

Expand Down
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static function testEndpointURL($endpointURL) {

$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if ($httpCode != 200) {
if ($httpCode != 200 && $httpCode != 301 && $httpCode != 302) {
$log->lwrite(' Failed connecting to ' . $endpointURL . ', error=' . $httpCode);
return false;
}
Expand Down

0 comments on commit 0a8eaf8

Please sign in to comment.