本文整理汇总了PHP中Curl::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Curl::instance方法的具体用法?PHP Curl::instance怎么用?PHP Curl::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Curl
的用法示例。
在下文中一共展示了Curl::instance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __callStatic
/**
* @param $method
* @param $arguments
* @return mixed
*/
public static function __callStatic($method, $arguments)
{
if (empty(self::$instance)) {
self::$instance = new static();
}
return call_user_func_array([self::$instance, $method], $arguments);
}
示例2: curlExec
private static function curlExec($requestList)
{
$responseList = array();
foreach ($requestList as $key => $request) {
Curl::instance()->open();
Curl::instance()->send($request);
$responseList[$key] = Curl::instance()->exec();
Curl::instance()->close();
}
return $responseList;
}
示例3: fetch
public static function fetch($url, $xml = false, $fields = false)
{
if (empty($url)) {
Debug::error("Missing Url for Curl");
return false;
}
if (!self::$instance) {
self::$instance = new self();
}
if ($xml) {
$results = self::$instance->xml($url, $fields);
} else {
$results = self::$instance->curl($url, $fields);
}
return $results;
}
示例4: action_list
/**
* 权限列表
*/
public function action_list()
{
$url = "http://i.s.lis.video.sina.com.cn:8081/program/getRtmpUrl";
$data = array('start_time' => time() + 3600, 'end_time' => time() + 7200, 'ip' => '123.126.53.54', 'session_id' => 'sdasdasdeals', 'appname' => 'finance', 'callback_url' => 'http://lis.sports.sina.com.cn');
// "http://i.s.lis.video.sina.com.cn:8081/program/getRtmpUrl/?start_time=1457065650&end_time=1457069250&ip=123.124.53.54&session_id=sdasdasdeals&appname=finance&callback_url=http://lis.sports.sina.com.cn"
$response = Curl::instance()->timeout(30)->url($url)->post($data);
echo $response->getCode() . "<br/>";
echo $response->getMessage() . "<br/>";
echo $response->getData() . "<br/>";
exit;
//$privileges = Model::factory('Privilege')->getPrivileges()->getObject();
// $navigators = Model::factory('Privilege')->getNavigators($privileges)->getObject();
// $menus = Model::factory('Privilege')->getMenus($privileges)->getObject();
// $controllers = Model::factory('Privilege')->getControllers($privileges)->getObject();
//$this->_default->content = View::factory('privilege/list')
//->set('privileges', $privileges);
// ->set('navigators', $navigators)
// ->set('menus', $menus)
// ->set('controllers', $controllers);
}
示例5: requestPost
/**
* post请求
* @param string $url url
* @param array $data 请求参数数组
* @return array
*/
public function requestPost($url, $data = array())
{
return $this->dealRequestData(Curl::instance()->post($url, $data));
}
示例6: instance
/**
*
* @return static
*/
static function instance()
{
if (self::$instance === null) {
self::$instance = new self();
}
return self::$instance;
}
示例7: mockUpload
public static function mockUpload($test)
{
Curl::$instance = $test->getMockBuilder("\\Cloudinary\\Curl")->setMethods(array("exec", "getinfo"))->getMock();
Curl::$instance->method("exec")->will($test->returnValue(Curl::$instance->uploadResponse));
Curl::$instance->method("getinfo")->will($test->returnValue(200));
}