Hack Forums
[PHP] Help about Php curl get cookies - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] Help about Php curl get cookies (/showthread.php?tid=6018021)



Help about Php curl get cookies - linhtinh - Oct 20, 2019

I'm trying use curl for login hulu.com and im use "preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $result, $matches);" for get cookies response

How can i get value cookie "bm_sv
value : 0AB7970228D4EDB3987C522EE182FE…MzpzebJKOyV4Qt9t54sLVSCfsVQ==" ,response of curl only show "_tcv" and "_h_csrf_id". Can i get solution for this case ?


RE: Help about Php curl get cookies - Charger - Oct 21, 2019

Don’t. Use curl cookie jar


RE: Help about Php curl get cookies - linhtinh - Oct 22, 2019

i dont use cookies jar my friend .Here is my curl :

"curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, random_uagent());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$result = curl_exec($ch);
preg_match_all('/^Set-Cookie:\s/mi', $result, $matches);"

Only response _tcv and _h_csrf_id ,no see bm_sv value cookie :(


RE: Help about Php curl get cookies - Charger - Oct 23, 2019

(Oct 22, 2019 12:46 AM)linhtinh Wrote:  i dont use cookies jar my friend .Here is my curl :

"curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
       curl_setopt($ch, CURLOPT_USERAGENT, random_uagent());
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
       curl_setopt($ch, CURLOPT_HEADER, 1);
       $result = curl_exec($ch);
      preg_match_all('/^Set-Cookie:\s/mi', $result, $matches);"

Only response _tcv and _h_csrf_id ,no see bm_sv value cookie :(
No.
USE COOKIE JAR. It’s made fo campuses it all. You’re making it way harder than it has to be


RE: Help about Php curl get cookies - newQuery - Oct 23, 2019

(Oct 23, 2019 09:19 AM)Charger Wrote:  No.
USE COOKIE JAR. It’s made fo campuses it all. You’re making it way harder than it has to be

I think what OP needs to understand, it's that COOKIE_JAR is a curl option.
How about that https://hotsource.dev/2019/04/29/php-curl-with-sessions/


RE: Help about Php curl get cookies - Charger - Oct 23, 2019

(Oct 23, 2019 02:48 PM)newQuery Wrote:  I think what OP needs to understand, it's that COOKIE_JAR is a curl option.
How about that https://hotsource.dev/2019/04/29/php-curl-with-sessions/

He needs to do anything but try to capture it with Regex. That ain’t gonna work well.


Nachfolger come take a look