Okay, I’m pretty new to cURL. I’ve managed to log into a webpage using cURL and sending POST data, but once I’m logged in, I’d like it to load various webpages under the same SESSION and extract data as a string, so that I can check if the webpage contains a specific string.
How would I go about doing this?
For example:
It logs into http://example.com/login.php
But after logging on, I need it to visit http://example.com/site.php?page=news and return the contents of that page as a string.
It generally depends on how the remote site handles state management.
In most cases, this will be via a cookie, so you’ll need to instruct curl to keep track of cookies.
Something like:
ought to get you started there.
EDIT
Blatant Copy/Paste Example (from here – found with about 20 seconds of googling “php curl login”). This looks to be about right: