As stated above, Curl will only get you cookies that the server sets but not JavaScript cookies (or server cookies that are guarded). The solution is to run a headless browsers like selenium.
i found a great tutorial to set everything up: https://www.zenrows.com/blog/selenium-php#install-selenium-in-php