Back to Documentation Overview

ping

public static ping(string apikey)

"Ping" the MailChimp API - a simple method you can call that will return a constant value as long as everything is good. Note than unlike most all of our methods, we don't throw an Exception if we are having issues. You will simply receive a different string back that will explain our view on what is going on.

Section:
Helper
Parameters:
apikey a valid API Key for your user account. Get by calling login()
Returns:
string   -  returns "Everything's Chimpy!" if everything is chimpy, otherwise returns an error message

Examples (1)

download example code

[1] xml-rpc_ping.php

  1. <?php
  2. /**
  3. This Example shows how execute a ping and check the result using XML-RPC.
  4. Note that we are using the PEAR XML-RPC client and recommend others do as well.
  5. **/
  6. require_once 'XML/RPC2/Client.php';
  7. require_once 'inc/config.inc.php';
  8. try {
  9. $client = XML_RPC2_Client::create($apiUrl);
  10.  
  11. $result = $client->ping($apikey);
  12. if ($result == "Everything's Chimpy!"){
  13. echo "Success, $result\n";
  14. } else {
  15. echo "Problems are a foot: $result\n";
  16. }
  17. } catch (XML_RPC2_FaultException $e){
  18. echo "ERROR!!!!\n";
  19. echo $e->getFaultCode()." : ".$e->getFaultString()."\n";
  20. }
  21.  
  22.  
Add New Note User Contributed Notes for ping
No notes, yet... Will you be the first??