Curl\Curl::options PHP 메소드

options() 공개 메소드

Options
public options ( $url, $data = [] ) : string
$url
$data
리턴 string
    public function options($url, $data = array())
    {
        if (is_array($url)) {
            $data = $url;
            $url = $this->baseUrl;
        }
        $this->setUrl($url, $data);
        $this->removeHeader('Content-Length');
        $this->setOpt(CURLOPT_CUSTOMREQUEST, 'OPTIONS');
        return $this->exec();
    }

Usage Example

예제 #1
0
<?php

require __DIR__ . '/vendor/autoload.php';
use Curl\Curl;
// curl --get --request OPTIONS "http://127.0.0.1:8000/" --data "foo=bar"
$curl = new Curl();
$curl->options('http://127.0.0.1:8000/', array('foo' => 'bar'));
if ($curl->error) {
    echo 'Error: ' . $curl->errorCode . ': ' . $curl->errorMessage;
} else {
    echo 'Response:' . "\n";
    var_dump($curl->response);
}
All Usage Examples Of Curl\Curl::options