使用发布请求登录。查看iframe

时间:2016-08-02 07:42:09

标签: php post iframe

我想使用发布请求登录外部网站。 (另一个站点显示在iframe中)

$url_1 = 'http://..............t.ru';
$ch = curl_init($url_1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Content-Type" => "application/json",
    "X-HTTP-Method-Override" => "POST",
    "Cache-Control" => "no-cache"
));
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIE, "my_id=511;my_name=name;my_fullName=fname;my_authid=501");
curl_setopt($ch, CURLOPT_POSTFIELDS, "my_id=511&my_name=name&my_fullName=fname&my_authid =501");

$result = curl_exec($ch);

我有两个站点,第二个站点在第一个站点的iframe中可见,我需要从第一个站点发送信息(cookie值),以便登录过程在第二个站点自动发生。问题是,我不知道我在哪里发送cookie值以及如何发送。

0 个答案:

没有答案
相关问题