static function sendRequest($url, $key, $secret) { $au = YiqifaUtils::generateOauth($url, $key, $secret); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: " . $au)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, "http://open.yiqifa.com"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $result = curl_exec($ch); curl_close($ch); return iconv("GBK", "UTF-8//IGNORE", $result); }
public function curl($url, $consumerKey, $consumerSecret) { $result = YiqifaUtils::sendRequest($url, $consumerKey, $consumerSecret); return $result; }