I need to setup a php script to call and run another php script that is on a different web server.
Basically, I have cron access on one server, but not on another and want to run a daily report on the server without cron access.
Is there a simply way to do this and how?
example:
- test1.php - lives here: http://www.website1.com/test1.php
- cron job runs test1.php
- test1.php runs and calls test2.php which lives here: http://www.website2.com/test2.php
- test2.php runs and does a simple query and emails results.
how do i call test2.php to run from the other website?
need php script to call/run another php script on different
Moderator: General Moderators
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
kind of like this?
$submit_url = "http://www.website2.com/test2.php";
$ch = curl_init($submit_url);
$result_page = curl_exec($ch);
curl_close ($ch);
$submit_url = "http://www.website2.com/test2.php";
$ch = curl_init($submit_url);
$result_page = curl_exec($ch);
curl_close ($ch);
you can also call it in a cron job using lynx I believe your syntax would look like this:
lynx -dump http://yoursite.com/yourPhpFile.php
lynx -dump http://yoursite.com/yourPhpFile.php
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England