You are here

function cc::load_url in Constant Contact 6.2

Same name and namespace in other branches
  1. 6.3 class.cc.php \cc::load_url()
  2. 7.3 class.cc.php \cc::load_url()

* Loads a specific URL, this method is used by the user friendly methods *

25 calls to cc::load_url()
cc::clear_contacts in ./class.cc.php
* Be careful with this method :) * You can use this to clear all contacts from a specific set of contact lists * * *
cc::create_campaign in ./class.cc.php
* Creates a new campaign * * @access public
cc::create_contact in ./class.cc.php
* Creates a new contact * * @access public
cc::create_contacts in ./class.cc.php
* This method is used to add 25 or more contacts * Pass this method an associative array of contact details * Alternatively you can give a path to a local or remote file * The file should be text or CSV format: * * * *
cc::create_list in ./class.cc.php
* Creates a new contact list * * * @access public

... See full list

File

./class.cc.php, line 202

Class

cc
@file

Code

function load_url($action = '', $method = 'get', $params = array(), $expected_http_code = 200) {
  $method = "http_{$method}";
  if (!method_exists($this, $method)) {
    $this->last_error = "{$method} method does not exist";
    return false;
  }
  $this
    ->{$method}($this->api_url . $action, $params);

  // handle status codes
  if (intval($expected_http_code) === $this->http_response_code) {
    if ($this->http_content_type) {
      return $this
        ->xml_to_array($this->http_response_body);
    }
    else {
      return $this->http_response_body;

      /* downloads the file */
    }
  }
  else {
    $this->last_error = "Invalid status code {$this->http_response_code}";
    return false;
  }
}