当前位置: 首页>>代码示例>>PHP>>正文


PHP Curl::setCookie方法代码示例

本文整理汇总了PHP中Curl::setCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP Curl::setCookie方法的具体用法?PHP Curl::setCookie怎么用?PHP Curl::setCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Curl的用法示例。


在下文中一共展示了Curl::setCookie方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_link

 public function get_link()
 {
     // Check Captcha
     $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LfXLBwTAAAAAKog-gWVMOmDJKhHGEMCELdR-Ukn&response=" . Input::get('g-recaptcha-response'));
     $obj = json_decode($response);
     if ($obj->success == false) {
         echo 'Captcha error';
         exit;
     } else {
         libxml_use_internal_errors(true);
         require_once app_path('Libraries/Curl.php');
         $url = Input::get('url');
         $url = str_replace("http://", "https://", $url);
         // step 1: Login
         $curl = new \Curl();
         $curl->get('https://www.fshare.vn');
         $session_id = $curl->getCookie('session_id');
         $doc = new \DOMDocument();
         $doc->loadHTML($curl->response);
         $xpath = new \DOMXpath($doc);
         $array = $xpath->query("//*[@id='login-form']//*[@name='fs_csrf']");
         foreach ($array as $value) {
             $fs_csrf = $value->getAttribute('value');
         }
         $curl->setCookie('session_id', $session_id);
         $curl->post('https://www.fshare.vn/login', array("fs_csrf" => $fs_csrf, "LoginForm[email]" => "phandung1111059@gmail.com", "LoginForm[password]" => "7508286", "LoginForm[rememberMe]" => "0", "yt0" => "Đăng nhập"));
         $session_id = $curl->getCookie('session_id');
         $curl->setCookie('session_id', $session_id);
         $curl->post('https://www.fshare.vn/login', array("fs_csrf" => $fs_csrf, "LoginForm[email]" => "phandung1111059@gmail.com", "LoginForm[password]" => "7508286", "LoginForm[rememberMe]" => "0", "yt0" => "Đăng nhập"));
         echo "Step 1: Login - Done !!! <br>";
         // step 2: Get link download
         $curl->get($url);
         $doc = new \DOMDocument();
         $doc->loadHTML($curl->response);
         $xpath = new \DOMXpath($doc);
         $array = $xpath->query("//*[@id='download-form']/div[1]/input");
         foreach ($array as $value) {
             $fs_csrf = $value->getAttribute('value');
         }
         $split_url = explode('/', $url);
         $curl->post('https://www.fshare.vn/download/get', array("fs_csrf" => $fs_csrf, "DownloadForm[pwd]" => "", "DownloadForm[linkcode]" => end($split_url), "ajax" => "download-form", "undefined" => "undefined"));
         echo "Step 2: Get Link Download - Done !!! <br><br>";
         echo "URL: " . @$curl->response->url;
         return redirect()->away($curl->response->url);
     }
     // END IF CHECK RECAPTCHA
 }
开发者ID:npdung,项目名称:Get-link,代码行数:47,代码来源:GetlinkController.php

示例2: setCookie

 public function setCookie($key, $value)
 {
     $this->curl->setCookie($key, $value);
     return $this;
 }
开发者ID:chenshuhao,项目名称:BeginShake,代码行数:5,代码来源:Client.php

示例3: testCookies

 public function testCookies()
 {
     $this->curl->setCookie('mycookie', 'yum');
     $this->assertTrue($this->server('GET', array('test' => 'cookie', 'key' => 'mycookie')) === 'yum');
 }
开发者ID:php-mod,项目名称:curl,代码行数:5,代码来源:CurlTest.php

示例4: Curl

<?php

require 'Curl.php';
// step 1
$curl = new Curl();
$curl->get('https://www.fshare.vn');
$session_id = $curl->getCookie('session_id');
$doc = new DOMDocument();
$doc->loadHTML($curl->response);
$xpath = new DOMXpath($doc);
$array = $xpath->query("//*[@id='login-form']//*[@name='fs_csrf']");
foreach ($array as $v) {
    $fs_csrf = $v->getAttribute('value');
}
// step 2
$curl->setCookie('session_id', $session_id);
$curl->post('https://www.fshare.vn/login', array("fs_csrf" => $fs_csrf, "LoginForm[email]" => "phandung1111059@gmail.com", "LoginForm[password]" => "7508286", "LoginForm[rememberMe]" => "0", "yt0" => "Đăng nhập"));
$session_id = $curl->getCookie('session_id');
// step 3
$curl->setCookie('session_id', $session_id);
$curl->post('https://www.fshare.vn/login', array("fs_csrf" => $fs_csrf, "LoginForm[email]" => "phandung1111059@gmail.com", "LoginForm[password]" => "7508286", "LoginForm[rememberMe]" => "0", "yt0" => "Đăng nhập"));
$curl->get('https://www.fshare.vn/account/profile');
$doc = new DOMDocument();
$doc->loadHTML($curl->response);
$xpath = new DOMXpath($doc);
$array = $xpath->query("//*[@id='ProfileForm_name']");
foreach ($array as $v) {
    $test = $v->getAttribute('value');
}
开发者ID:npdung,项目名称:Get-link,代码行数:29,代码来源:test.php


注:本文中的Curl::setCookie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。