On Fri, Jul 14, 2017 at 6:51 PM, bawolff <bawolff+wn@gmail.com> wrote:
If you are using the PHP curl extension:

You can get the various headers using the CURLOPT_HEADERFUNCTION callback option

You can set headers to send using the CURLOPT_HTTPHEADER option

If you are using curl (highly preferable), just set CURLOPT_COOKIEJAR and CURLOPT_COOKIEFILE to the same file (does not have to exist initially) for every request, and it will automatically handle cookies like a real browser would. Much more robust than trying to parse Set-Cookie headers yourself.