The Services method
The services method gets the services that the current user has enabled.
Basic usage
It can be used as follows:
<?php
$PHPingFM = new PHPingFM($developer_key, $user_api_key);
$services = $PHPingFM->services();
// The $services variable contains an array of the user's services.
?>
Return value
It returns an array structured like this (everything in italic can change, everything not in italic stays constant, bold is the key of an array and not bold is the value):- service's machine-readable name
-
- name
- service's human-readable name
- methods
- microblog
- status (the methods are an array of what posting methods the service supports, out of status, microblog and blog)
- service's machine-readable name
-
- name
- service's human-readable name
- methods
- microblog
- status (the methods are an array of what posting methods the service supports, out of status, microblog and blog)
- ...
Example usage
An example usage of this would be to see what services the user has available. Let's make a simple unordered list that shows all the current user's services (this user has a lot of services set up).The code behind that
Here's how we generated that:
<?php
$output = '<ul>';
$PHPingFM = new PHPingFM($developer_key, $user_app_key);
$services = $PHPingFM->services();
foreach ($services as $service) {
$output .= '<li>'. $service['name'] .'</li>';
}
$output .= '</ul>';
?>