Skip to content

Instantly share code, notes, and snippets.

@hanicker
Forked from caseysoftware/delete-recordings.php
Created March 5, 2016 21:16
Show Gist options
  • Select an option

  • Save hanicker/d267cacfd57a87ec8c6a to your computer and use it in GitHub Desktop.

Select an option

Save hanicker/d267cacfd57a87ec8c6a to your computer and use it in GitHub Desktop.
This is a simple script using the Twilio PHP Helper library to retrieve Recordings within a certain date range and then delete them.
<?php
// This assumes you have the Twilio PHP Helper library
require 'Services/Twilio.php';
// This is a file with my Account Sid and AuthToken
include 'credentials.php';
$client = new Services_Twilio($accountsid, $authtoken);
/*
* For the getIterator array, these are valid options:
* "DateCreated>" or "DateCreated<"
*/
foreach ($client->account->recordings->getIterator(0, 50, array('DateCreated>' => '2011-07-05 08:00:00', 'DateCreated<' => '2011-08-01')) as $recording) {
echo $recording->sid." -- ". $recording->date_created . "\n";
$client->account->recordings->delete($recording->sid);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment