Permalink
Browse files

Simple request calls

  • Loading branch information...
zeleznypa committed Jul 14, 2013
1 parent 7c0bcc5 commit 9f0f2b32d84567d00803bcf2b1ca3fbe1358c6ca
Showing with 74 additions and 0 deletions.
  1. +74 −0 Zeleznypa/Curl/Curl.php
@@ -64,6 +64,80 @@ public static function create()
return new self;
}
/**
* Simple way to call DELETE request
* @author Pavel Železný <info@pavelzelezny.cz>
* @param string $url
* @param mixed $data
* @param array $options
* @return tring|FALSE False on error
*/
public static function delete($url, $data = NULL, $options = array())
{
return self::create()
->setCommunicationMethod(self::DELETE)
->setUrl($url)
->setData($data)
->setOptions($options)
->execute()
->getResult();
}
/**
* Simple way to call GET request
* @author Pavel Železný <info@pavelzelezny.cz>
* @param string $url
* @param array $options Optional cURL options
* @return string|FALSE False on error
*/
public static function get($url, $options = array())
{
return self::create()
->setCommunicationMethod(self::GET)
->setUrl($url)
->setOptions($options)
->execute()
->getResult();
}
/**
* Simple way to call POST request
* @author Pavel Železný <info@pavelzelezny.cz>
* @param string $url
* @param mixed $data
* @param array $options
* @return tring|FALSE False on error
*/
public static function post($url, $data = NULL, $options = array())
{
return self::create()
->setCommunicationMethod(self::POST)
->setUrl($url)
->setData($data)
->setOptions($options)
->execute()
->getResult();
}
/**
* Simple way to call PUT request
* @author Pavel Železný <info@pavelzelezny.cz>
* @param string $url
* @param mixed $data
* @param array $options
* @return tring|FALSE False on error
*/
public static function put($url, $data = NULL, $options = array())
{
return self::create()
->setCommunicationMethod(self::PUT)
->setUrl($url)
->setData($data)
->setOptions($options)
->execute()
->getResult();
}
/**
* URL argument getter
* @author Pavel Železný <info@pavelzelezny.cz>

0 comments on commit 9f0f2b3

Please sign in to comment.