通过PHP CURL登录获取会话ID

时间:2019-05-26 16:35:08

标签: php html curl post login

我想通过PHP CURL登录到gounlimited.to,我想在登录后从以下页面获取值“ sess_id”:https://gounlimited.to/?op=upload_file

我尝试了以下代码,但未成功。我不会登录:

$ch = curl_init("http://gounlimited.to/");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');
curl_setopt($ch, CURLOPT_REFERER, '');
$arr = array('op' => 'login', 'login' => 'XXXX', 'password' => 'XXXX');
curl_setopt($ch, CURLOPT_POSTFIELDS, $arr); 
$output = curl_exec($ch);      
curl_close($ch);
print_r($output);

1 个答案:

答案 0 :(得分:0)

尝试获取标题,请添加以下选项。

from cloudfoundry_client.client import CloudFoundryClient
import os
target_endpoint = '<API_URL>'
proxy = dict(http=os.environ.get('HTTP_PROXY', ''), https=os.environ.get('HTTPS_PROXY', ''))
client = CloudFoundryClient(target_endpoint, proxy=proxy, verify=False)
client.init_with_user_credentials('<EMAIL>', '<PASSWORD>')
org_get = client.v2.organizations.get('<GUID>')
print(org_get)
for m in org_get.managers():
    print(m)