本文整理汇总了PHP中Curl::put方法的典型用法代码示例。如果您正苦于以下问题:PHP Curl::put方法的具体用法?PHP Curl::put怎么用?PHP Curl::put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Curl
的用法示例。
在下文中一共展示了Curl::put方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPutFileHandle
public function testPutFileHandle()
{
$png = $this->create_png();
$tmp_file = $this->create_tmp_file($png);
$this->curl->setOpt(CURLOPT_PUT, TRUE);
$this->curl->setOpt(CURLOPT_INFILE, $tmp_file);
$this->curl->setOpt(CURLOPT_INFILESIZE, strlen($png));
$this->curl->put(self::TEST_URL . '/server.php', array('test' => 'put_file_handle'));
fclose($tmp_file);
$this->assertTrue($this->curl->response === 'image/png');
}
示例2: putFile
/**
* @param $filePath
* @param null $size
*
* @return mixed
* @throws Exception
*/
public function putFile($filePath, $size = null)
{
$resource = fopen($filePath, 'r');
$response = $this->curl->put($resource, $size ? $size : filesize($filePath))->execute();
fclose($resource);
return $response;
}
示例3: setTimes
public function setTimes($path, $modificationTime = '', $accessTime = '')
{
$url = $this->_buildUrl($path, array('op' => 'SETTIMES', 'modificationtime' => $modificationTime, 'accesstime' => $accessTime));
return Curl::put($url);
}
示例4: _call
private function _call($call, $data = FALSE, $type = FALSE)
{
switch ($type) {
case "post":
$curl = new Curl();
$url = $this->api_host . $call . "?key={$this->key}";
$response = $curl->post($url, $data);
$response = json_decode($response->body);
return $response;
break;
case "put":
$curl = new Curl();
$url = $this->api_host . $call . "?key={$this->key}";
$response = $curl->put($url, $data);
$response = json_decode($response->body);
return $response;
break;
case "delete":
$curl = new Curl();
$url = $this->api_host . $call . "?key={$this->key}";
$response = $curl->request('DELETE', $url, $data);
$response = json_decode($response->body);
return $response;
break;
default:
$data["key"] = $this->key;
$curl = new Curl();
//$url = $this->api_host . $call . "?key=$this->key";
$url = $this->api_host . $call;
$response = $curl->get($url, $data);
$response = json_decode($response->body);
return $response;
break;
}
}
示例5: put
public static function put($path, $data)
{
$curl = new Curl();
$curl->put(\Slim\Slim::getInstance()->globalConfig['oaUrl'] . $path, $data);
return json_decode($curl->response->form, TRUE);
}
示例6: put
public function put($resource, array $params = array())
{
$url = $this->buildUrl($resource);
$curl = new Curl();
return $curl->put($url, $params);
}
示例7: Curl
- redefine $url to point to the location of this file, eg http://localhost/test.php
- run this script by browsing to it and appending a 'run' parameter to the url, eg http://localhost/test.php?run
*/
$url = 'http://localhost/~pandayak/curl/test.php';
if (isset($_GET['run'])) {
require 'curl.php';
$c = new Curl();
//test default behavior
$param = 'qwe';
$test = $c->get($url, array('param' => $param));
assert($param == $test);
$param = 'asd';
$test = $c->post($url, array('param' => $param));
assert($param == $test);
$param = 'zxc';
$test = $c->put($url, array('param' => $param));
assert($param == $test);
$param = '123';
$test = $c->delete($url, array('param' => $param));
assert($param == $test);
//test multi behavior w/ single requests
$param = 'qwe';
$test = $c->multi(array(array('get', $url, array('param' => $param))));
assert($param == $test[0]);
$param = 'asd';
$test = $c->multi(array(array('post', $url, array('param' => $param))));
assert($param == $test[0]);
$param = 'zxc';
$test = $c->multi(array(array('put', $url, array('param' => $param))));
assert($param == $test[0]);
$param = '123';
示例8: Curl
<?php
require '../src/Curl.class.php';
// curl -X PUT -d "id=1&first_name=Zach&last_name=Borboa" "http://httpbin.org/put"
$curl = new Curl();
$curl->put('http://httpbin.org/put', array('id' => 1, 'first_name' => 'Zach', 'last_name' => 'Borboa'));
echo 'Data server received via PUT:' . "\n";
var_dump($curl->response->form);