0

In this site, it requires Yes click before entering the page.

<a id="ok" href="./">Yes</a>
<script>
$('#ok').bind("click", function(e) {
    e.preventDefault();
    var min=60*24*7;
    var dt=new Date();
    dt.setTime(dt.getTime()+(min*60*1000));
    $.cookie('check','1'{domain:'exmaple.com',path:'/',expires:dt});
    window.location.reload();
}
</script>

Now I checked the source and understood it needs cookie as check=1.

then, I crawl like this in the php script using file_get_contents.

$url = "https://www.example.com";
$source = file_get_contents($url,false,$context);

How can I set the cookie ? or is it possible??

whitebear
  • 11,200
  • 24
  • 114
  • 237

1 Answers1

0

This gives me the answer.

Send cookie with file_get_contents

$opts = array(
  'http'=>array(
    'method'=>"GET",
    'header'=>"Accept-language: en\r\n" .
              "Cookie: foo=bar\r\n"
  )
);

$context = stream_context_create($opts);
whitebear
  • 11,200
  • 24
  • 114
  • 237