I use cURL to analyze the website.
http://www.hcmiu.edu.vn/bookforsale/showbooks.php
Viewing requires a session if you do not have a session and then redirects the page to:
http://www.hcmiu.edu.vn/bookforsale/perInfo.php
I use this code to get a session cookie, but I donβt know why I donβt see any changes in the cookie.txt
$urltopost = "http://www.hcmiu.edu.vn/bookforsale/perInfo.php"; $datatopost = array ( "name" => "abc", "tel" => "99999999", "email" => " abc@gmail.com ", "profession" => "abc", "employer" => "abc", "tel_work" => "99999999", ); $ch = curl_init($urltopost); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $datatopost); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/cookies.txt"); $returnData = curl_exec($ch); $file = fopen("example.txt", "w"); fwrite($file, $returnData); fclose($file); curl_close($ch);
However, I see:
Set-Cookie: PHPSESSID=1egb993objkrdp3gi5mpvs02g0; path=/
in the title. Thanks for any help
-Edit: I use the tricky way: I use the http viewer to view the PHPSESSID in the browser. And then I use it to create a cookie to read cURL. Then I can go through a web server session check to view the showbooks.php file.
source share