Hello I am trying to figure out how I can create a cron job for file "update.php" that when it runs it, it will then try to run 12 other php files I have.. PLUS a data base file...
Currently I am doing this.. BUT I am receiving a lot of errors and the scritp stops running...
--------------------------------------…
update.php file
--------------------------------------…
<?
error_reporting(E_ALL);ini_set('displa… 1);
require_once ("getAquarius.php");
require_once ("getAries.php");
require_once ("getCancer.php");
require_once ("getGemini.php");
require_once ("getLeo.php");
require_once ("getLibra.php");
require_once ("getPisces.php");
require_once ("getSagittarius.php");
require_once ("getScorpio.php");
require_once ("getTaurus.php");
require_once ("getVirgo.php");
?>
EACH of the 12 files does the same thing..
--------------------------------------…
getAquarius.php
--------------------------------------…
<?php
include("db.php");
$url = "http://my.horoscope.com/astrology/free-…
$start_text2 = '<div class="fontdef1" style="padding-right:10px;" id="textline">';
$end_text2 = '<div align="right">';
$source2 = file_get_contents($url);
$start_pos2 = strpos($source2, $start_text2) + strlen($start_text2);
$end_pos2 = strpos($source2, $end_text2) - $start_pos2;
$content = substr($source2, $start_pos2, $end_pos2);
$scopeid = rand(10000, 600000);
$text = dbPrepare(trim(strip_tags($content)));
$scopeFriendsOne = rand(1, 4);
$scopeFriendsTwo = rand(5, 7);
$scopeFriendsThree = rand(9, 12);
$randNumOne = rand(0,18);
$randNumTwo = rand(19,32);
$randNumThree = rand(33,48);
$randNumFour = rand(49,61);
$randNumFive = rand(62,80);
$randNumSix = rand(81,100);
$luckynumbers = $randNumOne.",".$randNumTwo.",".$randNum…
$starsLove = rand(1, 5);
$starsMoney = rand(1, 5);
$starsHealth = rand(1, 5);
$starsCareer = rand(1, 5);
$starsNumbers = $starsLove.",".$starsMoney.",".$starsMon…
mysql_query("INSERT INTO Aquarius (scopeid, horoscope, friendone, friendtwo, friendthree, luckynumbers, stars) VALUES ($scopeid, '".$text."', $scopeFriendsOne, $scopeFriendsTwo, $scopeFriendsThree, '".$luckynumbers."', '".$starsNumbers."')");
?>
AND here is the db.php that each file is requiring
--------------------------------------…
db.php
--------------------------------------…
<?
$dbname = "SITENAME"; //dbname
$dbhost = "LOCALHOST";
$dbuser = "USERNAME";
$dbpass = "PASSWORD";
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname, $conn);
function dbPrepare($str){
$str = mysql_real_escape_string($str);
return $str;
}
?>
When cron runs the update.php file to get the infromation and post it into my database, I then get and error and the cron/update.php file stops running..
I could create a cron file for each of the php files but my hosting server (GoDaddy) only allows me to have 10 cron files..
BASICALLY I am wanting the crop job to execute update.php at a specific time and when it runs it I want the update.php file to open the first php file do its thing then close it and move on to the next file and so on an so forth till all 12 files have run...
IF anyone can help please that would be great