Unirest\Request::patch PHP Method

patch() public static method

Send PATCH request to a URL
public static patch ( string $url, array $headers = [], mixed $body = null, string $username = null, string $password = null ) : unirest\Response
$url string URL to send the PATCH request to
$headers array additional headers to send
$body mixed PATCH body data
$username string Basic Authentication username (deprecated)
$password string Basic Authentication password (deprecated)
return unirest\Response
    public static function patch($url, $headers = array(), $body = null, $username = null, $password = null)
    {
        return self::send(Method::PATCH, $url, $body, $headers, $username, $password);
    }

Usage Example

Example #1
0
 public function testPatch()
 {
     $response = Request::patch('http://mockbin.com/request', array('Accept' => 'application/json'), array('name' => 'Mark', 'nick' => 'thefosk'));
     $this->assertEquals(200, $response->code);
     $this->assertEquals('PATCH', $response->body->method);
     $this->assertEquals('Mark', $response->body->postData->params->name);
     $this->assertEquals('thefosk', $response->body->postData->params->nick);
 }
All Usage Examples Of Unirest\Request::patch