Change the status of recurring regulations via API

If you ever wanted to change the status of existing recurring regulations found at Transactions > Recurring commissions   via API, then the following sample script might come in handy:
include_once 'PapApi.class.php';
$papURL = "URL_TO_PostAffiliatePro"; //URL to Post Affliate Pro including protocol, but without any trailing slash
$merchantUsername = ""; //merchant username
$merchantPassword = "123456"; //merchant password
$session = new Pap_Api_Session($papURL."/scripts/server.php");
if(!@$session->login($merchantUsername,$merchantPassword)) {  
  die("Can't login: ".$session->getMessage());
$request = new Gpf_Rpc_FormRequest("Pap_Features_RecurringCommissions_RecurringCommissionsForm", "changeStatus", $session); 
//Let's define the IDs of recurring regulations to be affected. 
//Click here to find out how to get the IDs of recurring regulations via API
$request->addParam('ids',new Gpf_Rpc_Array(array('351b6ef9','edb0b9dd')));
$request->addParam('status', 'A'); //A = approved; P = Pending; D = Declined;
// send request 
try { 
} catch(Exception $e) { 
    die("API call error: ".$e->getMessage()); 
That's it.