Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

How can I run the php script or the page without visiting the page?

I have a report page which I can create a report by only visiting the PHP page. ( I have username and password protection for this page)

How can I run the php script or the page without visiting the page?

For example I want to recieve the report everyday, but I have to visit the page to run the php script every day.

what do you suggest I should do?

I use PHP and mysql.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BR

ASKER

thank you very much
You're welcome, glad to help.
Depending on the authentication type, cURL may be able to pass the credentials.  See options for CURLOPT_HTTPAUTH, CURLOPT_USERPWD.

The cron job can do many things that a regular web script can do, however its environment will not be the same.  Your first cron job should be something like this.  The output will be hard to read, but worth working through to understand its environment.
<?php
ob_start();
phpinfo();
$buf = ob_get_clean();
mail('you@your.org', 'cron phpinfo()', $buf);

Open in new window

Many servers will assume that cron failed if the cron script produces browser output.  This makes sense because cron jobs are not intended to be run from the browser.
Avatar of BR

ASKER

Thank you Ray Paseur
Avatar of BR

ASKER

I realized that, I have Cron on my Cpanel. Cron solved my problem for good. Thank you all