fork download
  1. <?php
  2. $sessionId = '2454bb7293c234332f25b39830387bf0'; // Retrieve this from the browser's cookies or another source
  3. //$client = new \GuzzleHttp\Client();
  4. //$response = $client->request('GET', 'https://l...content-available-to-author-only...l.test/guestcart/index/index', [
  5. //'headers' => [
  6. //'Cookie' => 'PHPSESSID=' . $sessionId
  7. //]
  8. //]);
  9. //$sessionValue = (string) $response->getBody();
  10. //echo $sessionValue;
  11. // Initialize cURL session
  12. $ch = curl_init();
  13.  
  14. // Set the URL of the Magento endpoint
  15. curl_setopt($ch, CURLOPT_URL, "https://l...content-available-to-author-only...l.test/guestcart/index/index");
  16.  
  17. // Set cURL options
  18. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  19. curl_setopt($ch, CURLOPT_HTTPHEADER, [
  20. 'Cookie: PHPSESSID=' . $sessionId
  21. ]);
  22.  
  23. // Execute the request
  24. $response = curl_exec($ch);
  25.  
  26. // Check for errors
  27. if (curl_errno($ch)) {
  28. echo 'cURL error: ' . curl_error($ch);
  29. } else {
  30. // Output the response
  31. echo 'Session value: ' . $response;
  32. }
  33.  
  34. // Close cURL session
  35. ?>
Success #stdin #stdout 0.03s 26252KB
stdin
Standard input is empty
stdout
cURL error: Could not resolve host: liverpool.test