-
-
Save brianherman/879998 to your computer and use it in GitHub Desktop.
thingy
This file contains 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
/** | |
* Delete file | |
* | |
* @param id[required] $id | |
* @param reason[required] $reason | |
* @return Response stdClass if succes, or FALSE if there error. | |
*/ | |
public function delete($id=null, $reason="") { | |
if(($id==null) or (empty($id))) | |
throw new Exception("MISSING_PARAMETER: No id given."); | |
if(($reason==null) or (empty($reason))) | |
throw new Exception("MISSING_PARAMETER: No reason given."); | |
//Blip.tv fields | |
$data = array( | |
'cmd' => "delete", | |
'section' => "posts", | |
'item_type' => "file", | |
'post' => "1", | |
'skin' => "api", | |
'userlogin' => $this->username, | |
'password' => $this->password, | |
'item_id' => $id, | |
'reason' => $reason | |
); | |
//Setting http class settings | |
$http=new http_class; | |
$http->timeout = 0; | |
$http->data_timeout = 0; | |
$arguments = array(); | |
$response = ""; | |
$http->GetRequestArguments(self::gateway . '?' . http_build_query($data),$arguments); | |
$arguments["RequestMethod"] = "POST"; | |
$arguments["User-Agent"] = "blipPHP (http://code.google.com/p/blip-php/)"; | |
$arguments["PostValues"] = $data; | |
//Make the request | |
$http->Open($arguments); | |
$http->SendRequest($arguments); | |
$http->ReadReplyBody($response,1000); | |
$xml_response = simplexml_load_string($response); | |
if(strtoupper($xml_response->status) == "ERROR") | |
if(strtoupper($xml_response->error->code) == "AUTHENTICATION_REQUIRED") | |
throw new Exception("AUTHENTICATION_REQUIRED: Bad login information."); | |
return $xml_response; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment