Running cronjob as a registered user

I am currently running php cronjob to scan through some HTML. I came to a scenario where I need to log in to access some data. How can this be achieved?

Cronjob runs on a server that I do not have access to.

Basically, let me say that I'm trying to access some HTML data that is only available after a user logs in. I have login details but you don’t know how to implement it with cronjob.

Hooray!

+4
source share
2 answers

In the "user logs in" section, I suppose you mean that "the user will log in if he uses a browser"?

If so, your PHP script that crawls through HTML should:

  • POST data, for example, if it is populated on the form
  • Get a response from the server; probably extract session cookies.
  • Send these cookies for subsequent requests.

You may be interested in using some existing library to facilitate this.
For example, you can take a look at Zend_Http_Client ( see also ; the part of Sending multiple requests with the same client probably interested you ;-))


You can also see other questions / answers, for example:

+3
source

You can use SimpleBrowser from SimpleTest to automate scanning. This is part of the SimpleTest platform, but you can use it yourself.

0
source

All Articles