How to revoke login protected url using goutte (i have an account)

I found a similar question here. But I didn't get enough information, so I decided to ask a new question.

let's assume the urls are as follows.

url1. http://base_url/login
url2. http://base_url/home
url3. http://base_url/target

Note: if I logged in url1, site redirects to url2 after login and
      2 cookies are saved on browser(called CTID, CTP).

      

I want to remove url3, but url3 can be retrieved after login.

I wrote a program like this.

use Goutte\Client;
... ...
$client = new Client();
$client->setHeader('User-Agent', "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36");

$crawler = $client->request('GET', 'url1');
$form = $crawler->selectButton('LOGON')->form();
$crawler = $client->submit($form, array('ID' => '***', 'PASS' => '***'));
dump($crawler->html());  //1

$crawler = $client->request('GET', 'url3');
dump($crawler->html());   //2

      

Instruction 1 outputs the url2 result correctly (this means the login was successful). i but i couldnt get url3 content. How can I get url3 content? Thanks for reading my question.

+3


source to share





All Articles