After googling for hours trying to find an answer for my problem I hope someone on SE can give me an answer.
I am trying to parse some PDF files from a website, the format of the URL looks like this: example.com/?s=ef6d225b80c0c590da26dcf1e37bc02c&t=2-1-2014%2013:24:25
I have no idea how I can fetch the session ID from this URL.
I tried something like this:
session_write_close();
$ch = curl_init($link);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt( $ch, CURLOPT_COOKIE, $strCookie );
$response = curl_exec($ch);
curl_close($ch);
ini_set("session.use_cookies",0);
ini_set("session.use_trans_sid",1);
session_id($_GET['session_id']);
print_r($_SESSION);
print(session_id());
But there is no output.
So what I need the session ID to pass into the URL and I have no idea how to do this.
I appreciate any help I can get about this issue. Thanks!
You can get it from $link
:
if (preg_match('~s=([a-f0-9]{32})~', $link, $match)) {
// got the session id in $match[1]
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.