Created
February 21, 2012 06:58
-
-
Save caseysoftware/1874567 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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
What I need to do if I want to delete all the records which are older then 1 day dynamically, currently hardcoded date is passed, I need the php code for doing same, please help me