💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
~~~ //设置post的数据 $post = array ( 'email' => '账户', 'pwd' => '密码' ); //登录地址 $url = "登陆地址"; //设置cookie保存路径 $cookie = dirname(__FILE__) . '/cookie.txt'; //登录后要获取信息的地址 $url2 = "登陆后要获取信息的地址"; //模拟登录 login_post($url, $cookie, $post); //获取登录页的信息 $content = get_content($url2, $cookie); //删除cookie文件 @ unlink($cookie); var_dump($content); //模拟登录 function login_post($url, $cookie, $post) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 0); curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); curl_exec($curl); curl_close($curl); } //登录成功后获取数据 function get_content($url, $cookie) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); $rs = curl_exec($ch); curl_close($ch); return $rs; } ~~~