Skip to content

Instantly share code, notes, and snippets.

@brianherman
Created March 21, 2011 19:05
Show Gist options
  • Save brianherman/879998 to your computer and use it in GitHub Desktop.
Save brianherman/879998 to your computer and use it in GitHub Desktop.
thingy
/**
* 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