|
uri = $uri;
}
public function __call($method, $params = array()) {
$data = $this->pack($method, $params);
if ($res = $this->exec($data)) {
return $res;
}
exit('采集错误!方法' . $method . ' 参数:' . json_encode($params));
}
public function exec($data) {
//执行最多5次,防止失败!
for ($i = 1; $i uri, $data);
if ($content) return $this->unpack($content);
}
return false;
}
/**
* from Yar_Simple_Protocol
*
* @param $method
* @param $params
* @return array
*/
public static function pack($method, $params) {
$struct = array(
'i' => time(),
'm' => $method,
'p' => $params,
);
$body = str_pad('PHP', 8, chr(0)) . serialize($struct);
//transaction id
$header = sprintf('%08x', mt_rand());
//protocl version
$header .= sprintf('%04x', 0);
//magic_num, default is: 0x80DFEC60
$header .= '80DFEC60';
//reserved
$header .= sprintf('%08x', 0);
//reqeust from who
$header .= sprintf('%064x', 0);
//request token, used for authentication
$header .= sprintf('%064x', 0);
//request body len
$header .= sprintf('%08x', strlen($body));
$data = '';
for ($i = 0; $i
慕大夜 发表于 2018-4-18 21:47
我 草 不会吧,我找源码没有扫的习惯也不会,多谢提醒,我这就去255了,防止别的mjj上当,之前用了我 ...
我想了下还是不255,这样没人看到了,我已经把网盘地址去掉了。 |
|