Class SaeFetchInternal
SAE Internal Curl 服务 API,用于通过内网请求SAE的应用接口
<?php $fetch_instance = new SaeFetchInternal(); // 设置需要抓取的应用 $fetch_instance->setAppname('www'); // 设置需要抓取的版本 $fetch_instance->setVersion('1'); // 设置使用的域名后缀,默认为applinzi.com $fetch_instance->setDomain('appchizi.com'); // 设置请求超时时间,单位秒 $fetch_instance->setTimeout(5); // 发送GET请求 $ret = $fetch_instance->get("/"); if ($ret === false) { var_dump($fetch_instance->errno(), $fetch_instance->errmsg()); } else { var_dump($ret); } // 发送POST请求 $ret = $fetch_instance->post("/a.php", array('b' => 1, 'c'=> 2), array('content-type: application/json', 'other: example')); if ($ret === false) { var_dump($fetch_instance->errno(), $fetch_instance->errmsg()); } else { var_dump($ret); } // 获取curl请求返回的header头信息 $ret = $fetch_instance->getOutHeaders(); var_dump($ret); // 获取curl请求的状态信息,例如获取curl请求的状态码。 $ret = $fetch_instance->curlInfo(); var_dump($ret["http_code"]); ?>
- SaeObject
- SaeFetchInternal
public
|
#
__construct( string $appname = '', string $version = '', integer $timeout = 0 )
SaeFetchInternal constructor. |
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean|string
|
|
public
boolean|string
|
|
public
boolean|string
|
|
public
boolean|string
|
|
public
boolean|string
|
|
public
array
|
|
public
array
|
|
public
integer
|
|
public
string
|
public
|
$sk
应用的 secret key |
#
SAE_SECRETKEY
|