/** * [_parseSina 解析新浪播客] * @param [type] $url [description] * @return [type] [description] */ private static function _parseSina($url) { $data = Sina::parse($url); return $data; }
$fields_string .= $key . '=' . $value . '&'; } $fields_string = rtrim($fields_string, '&'); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); //要提交的内容 //把返回$cookie_jar来的cookie信息保存在$cookie_jar文件中 curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_jar); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); //设定返回的数据是否自动显示 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //设定是否显示头信息 curl_setopt($ch, CURLOPT_HEADER, 1); //curl_setopt($ch, CURLOPT_HTTPHEADER, $headers_login); //设定是否输出页面内容 curl_setopt($ch, CURLOPT_NOBODY, 0); $result = curl_exec($ch); print preg_match('/Location:[^\\"].*/', $result, $location); if (empty($location)) { //exit("登录错误!"); return 0; } list($lc, $urltemp) = explode(':', $location[0], 2); $this->gurl = $urltemp; curl_close($ch); //get data after login } } $username = '******'; $password = '******'; $sina = new Sina($username, $password); $sina->sinaLogin($username, $password);