I have two files: A.php and B.php.
Contents of A.php:
<?php
$ch = curl_init();
curlsetopt($ch,CURLOPT_URL,'localhost/b.php');
curl_exec($ch);
?>
Contents of B.php:
<?php
print_r($_COOKIE);
?>
it isn't printing COOKIES when loading A.php but printing when loading b.php directly.please help thanks
A.php.B.phpfrom your browser, any cookies would be stored/read on your local browser session. When loadingB.phpvia cURL throughA.php,Bwould look for cookies on the browser session than made the request (cURLonlocalhost) not your local browser session.