skymvc/library/cls_curl.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
class curl{
public $ch;
public $curl_json=false;
function __construct(){
}
function init($url){
$this->ch=curl_init();
$header = array(
"Content-Type:application/x-www-form-urlencoded; charset=UTF-8"
);
curl_setopt($this->ch, CURLOPT_URL, $url);
curl_setopt($this->ch, CURLOPT_HTTPHEADER , $header);
curl_setopt($this->ch, CURLOPT_HEADER, 0);
curl_setopt ($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, false);
}
function setJson($json){
curl_setopt($this->ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($json))
);
}
function get($url,$data=array()){
$this->init($url);
curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, 'GET');
if($this->curl_json){
$this->setJson($data);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
}else{
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
}
$content= curl_exec($this->ch);
curl_close($this->ch);
return $content;
}
function post($url,$data=array(),$header=array()){
$this->init($url,$header);
//curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($this->ch, CURLOPT_POST, TRUE);
if($this->curl_json){
$this->setJson($data);
}
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, 2);
$ret = curl_exec($this->ch);
if($ret===false){
exit( curl_error($this->ch) ) ;
}
curl_close($this->ch);
return $ret;
}
function put($url,$data=array()){
后面还有 23 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。