I’m making an app that scrapes data off a site, formats it as needed, and displays it to the user. Now, the site doesn’t allow cross-site script requests, so I’m using PHP’s curl to retrieve the page.
-
With a browser, the site gives you a cookie when you first visit, asking you to log in, and on subsequent requests will give you the actual page you requested.
-
With PHP’s curl, the site will just give me the page asking me to log in. And, I presume, give my PHP server a cookie.
How can I save this cookie and present it on subsequent requests?
use a few setopts to set the cookie.
Example: