lithium\net\socket\Curl::set PHP Méthode

set() public méthode

Sets the options to be used in subsequent curl requests.
public set ( array $flags, array $value = null ) : void
$flags array If $values is an array, $flags will be used as the keys to an associative array of curl options. If $values is not set, then $flags will be used as the associative array.
$value array If set, this array becomes the values for the associative array of curl options.
Résultat void
    public function set($flags, $value = null)
    {
        if ($value !== null) {
            $flags = array($flags => $value);
        }
        $this->options = $flags + $this->options;
    }

Usage Example

Exemple #1
0
 public function testWriteAndRead()
 {
     $stream = new Curl($this->_testConfig);
     $this->assertTrue(is_resource($stream->open()));
     $this->assertTrue(is_resource($stream->resource()));
     $stream->set(CURLOPT_URL, $this->_testUrl);
     $this->assertTrue($stream->write(null));
     $this->assertTrue($stream->read());
     $response = $stream->send(new Request(), array('response' => 'lithium\\net\\http\\Response'));
     $this->assertEqual(trim(file_get_contents($this->_testUrl)), trim($response->body()));
     $this->assertNull($stream->eof());
 }
All Usage Examples Of lithium\net\socket\Curl::set