You are here

function ConstantContact::_send in Constant Contact 6

Same name and namespace in other branches
  1. 5 ConstantContact.php \ConstantContact::_send()

Method used to send the data to the CC server

@access private

2 calls to ConstantContact::_send()
ConstantContact::add in ./ConstantContact.php
Add a subscriber to your constant contact account, can be used to update their details too
ConstantContact::remove in ./ConstantContact.php
Remove a subscriber from your constant contact account

File

./ConstantContact.php, line 193

Class

ConstantContact
Class to interact with the constant contact API This class enables you to easily subscribe and unsubscribe members

Code

function _send($data, $url) {
  if (!function_exists('fopen')) {
    exit("fopen function does not exist");
  }
  if (!ini_get('allow_url_fopen')) {
    @ini_set('allow_url_fopen', '1');
  }
  if (!ini_get('allow_url_fopen')) {
    exit("allow_url_fopen is not enabled in your php config file");
  }
  $handle = fopen("{$url}?{$data}", "rb");
  $contents = '';
  while (!feof($handle)) {
    $contents .= fread($handle, 192);
  }
  fclose($handle);
  if (trim($contents) == 0) {
    return true;
  }
  return false;
}