function cc::load_url in Constant Contact 7.3
Same name and namespace in other branches
- 6.3 class.cc.php \cc::load_url()
- 6.2 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 
- Clear all contacts.
- cc::create_campaign in ./class.cc.php 
- Creates a new campaign.
- cc::create_contact in ./class.cc.php 
- Creates a new contact.
- cc::create_contacts in ./class.cc.php 
- Bulk create contacts.
- cc::create_list in ./class.cc.php 
- Creates a new contact list.
File
- ./class.cc.php, line 1834 
- Constant Contact PHP Class
Class
- cc
- @file Constant Contact PHP Class
Code
function load_url($action = '', $method = 'get', $params = array(), $expected_http_code = 200) {
  $this
    ->http_send($this->api_url . $action, $method, $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}";
    // If there was an error sometimes the body contains useful info.
    return FALSE;
  }
}