已掉线,重新登录

首页 > 绿虎论坛 > 历史版块 > 编程 > PHP > 源码

标题: 这个类哪错了…第一次写类

作者: @Ta

时间: 2014-02-06

点击: 1783

@老虎会游泳
YH没CURL,我买的空间还没开错误提示…所以…
调用页面代码:
<?php
error_reporting(E_ALL&~E_DEPRECATED&~E_NOTICE);
include "confid.php";
include "dnspod.class.php";
$cs=new dnspod();
var_dump($cs);  //执行完这里,后面就没有了
$cs->dns_cx(); 
var_dump($cs);

类:
<?php
class dnspod{
protected $api_addr;
protected $api_data=array();
public $result;
function __construct(){
$this->api_data["login_email"]=LOGIN_EMAIL;
$this->api_data["login_password"]=LOGIN_PASSWORD;
$this->api_data["format"]="json";
$this->api_data["lang"]="zh";
$this->api_data["error_on_empty"]="no";
}
protected function dns_curl(){
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"https://dnsapi.cn/".$this->api_addr);
curl_setopt($ch,"CURLOPT_POST",1);
curl_setopt($ch,"CURLOPT_POSTFIELDS",http_build_query($this->api_data));
curl_setopt($ch,"CURLOPT_USERAGENT",POST_UA);
curl_setopt($ch,CURLOPT_HEADER,0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);
$result=curl_exce($ch);
curl_close($ch);
return $result;
}
function dns_cx(){
$this->api_addr="Domain.Create";
$this->api_data["domain_id"]=DOMAIN_ID;
$this->result=$this->dns_curl();
}
}
?>

[隐藏样式|查看源码]


『回复列表(4|隐藏机器人聊天)』

1. 谁说yh不支持curl?
(/@Ta/2014-02-06 13:54//)

2. @齐子

(/@Ta/2014-02-06 14:28//)

3. yh不支持curl?不可能吧!我以前搭建的宜搜小偷还能偷小说啊(我的就是yh)
(/@Ta/2014-02-06 16:55//)

4. 我写错两个地方…
curl_setop的第二个变量不能加引号
curl_exec写错了
YH支持curl
@梦浪的小虾米 @齐子 
(/@Ta/2014-02-06 20:27//)

回复需要登录

10月11日 16:38 星期六

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1