I have been requested to execute a script located in another server, the script can be executed via the browser easily (it has a small log in page, and then by visiting the url the script (in .cfm) is executed)
How can I do this with PHP? I’m thinking on using curl_exec to visit the page, but I don’t know how I can pass the log in.. Is that even possible?
Yes it is possible; you can pass the login very easily by submitting normal POST data to the form. I assume you have a name/password you can use, so you can just pass these with
CURLOPT_POSTFIELDS.If you need to visit an additional URL after logging in, you need the SID either from the effective URL or more stably from the cookie.
On the initial
curl_execset theCURLOPT_COOKIEJARto any blank file (it can be a tmp file). On subsequentcurl_exec, set the URL appropriately and setCURLOPT_COOKIEFILEto this same file.