Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8925113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:36:39+00:00 2026-06-15T07:36:39+00:00

EDIT: Cron line: /usr/bin/php /usr/local/yy/yy/yy/webspace/httpdocs/test.mysite.ie/test.php > /dev/null 2>&1 I have written a script that

  • 0

EDIT: Cron line: /usr/bin/php /usr/local/yy/yy/yy/webspace/httpdocs/test.mysite.ie/test.php > /dev/null 2>&1

I have written a script that functions as it should when i navigate to it in the browser. This is my first time trying to use a cron job so i’m not overly familiar with how they work. The script is below. As i said, the script works as it should if i navigate to the url in a web browser.

test.php

<script src="jquery.min.js"></script>
<script>
//SET UP JS VARIABLES
var allMatchedNumbers = new Array();
var matchedthingyNumbers;
var matchedthingyPlus1Numbers;
var matchedthingyPlus2Numbers;
var winningthingyNumbers = new Array();
var winningBonusNumber;
var winningthingyPlus1Numbers = new Array();
var winningPlus1BonusNumber;
var winningthingyPlus2Numbers = new Array();
var winningPlus2BonusNumber;
var thingyList;
var thingyListItems;
var thingyPlus1List;
var thingyPlus1ListItems;
var thingyPlus2List;
var thingyPlus2ListItems;
var userNumbers = new Array();
var displayCounter = 1;
var drawDate;
var thingyNumbers;
var thingyBonus;
var thingyPlus1;
var thingyPlus1Bonus;
var thingyPlus2;
var thingyPlus2Bonus;

//GET RESULTS & DATE FOR thingy, PLUS1, PLUS2 FROM THE DOM OBJECT ONLY
$(document).ready(function fetchResults(){
    $.ajax({
        url: "scrape_page.php",
        success: function(data) {
        } 
    });

    $.ajax({
        url: "latest_results.txt",
        success: function(data) {
            var dom = $(data);
            //GET thingy DATE
            drawDate = dom.find('.date-heading.fooRegular').contents().first().text();
            //GET thingy NUMBERS
            thingyNumbers = dom.find('.result-block').eq(0).find('.thingy-winning-numbers');
            thingyBonus = dom.find('.result-block').eq(0).find('.thingy-bonus');
            thingyPlus1 = dom.find('.result-block').eq(1).find('.thingy-winning-numbers');
            thingyPlus1Bonus = dom.find('.result-block').eq(1).find('.thingy-bonus');
            thingyPlus2 = dom.find('.result-block').eq(2).find('.thingy-winning-numbers');
            thingyPlus2Bonus = dom.find('.result-block').eq(2).find('.thingy-bonus');
            populateWinningNumbers();
        } 
    });
});


//PUT WINNING NUMBERS IN ARRAY
function populateWinningNumbers() {
    //MAIN thingy NUMBERS
    thingyList = thingyNumbers;
    thingyListItems = thingyList.find('li');
    thingyPlus1List = thingyPlus1;
    thingyPlus1ListItems = thingyPlus1List.find('li');
    thingyPlus2List = thingyPlus2;
    thingyPlus2ListItems = thingyPlus2List.find('li');

    thingyListItems.each(function(index) {
        winningthingyNumbers[index] = parseInt($(this).text());
    });
    //winningBonusNumber = parseInt($('#mainthingyBonus').find('li').text());
    winningBonusNumber = parseInt($(thingyBonus).find('li').text());
    winningthingyNumbers.push(winningBonusNumber);

    //thingy PLUS NUMBERS
    thingyPlus1ListItems.each(function(index) {
        winningthingyPlus1Numbers[index] = parseInt($(this).text());
    });
    winningPlus1BonusNumber = parseInt($(thingyPlus1Bonus).find('li').text());
    winningthingyPlus1Numbers.push(winningPlus1BonusNumber);
    //PLUS 2
    thingyPlus2ListItems.each(function(index) {
        winningthingyPlus2Numbers[index] = parseInt($(this).text());
    });
    winningPlus2BonusNumber = parseInt($(thingyPlus1Bonus).find('li').text());
    winningthingyPlus2Numbers.push(winningPlus2BonusNumber);

    postDataToDB();
}

//POST OFFICIAL thingy NUMBERS TO DATABASE
function postDataToDB() {
    $.ajax({
        url: "postToDB.php",
        type: "post",
        data: {thingyNums:winningthingyNumbers, thingyPlus1Nums: winningthingyPlus1Numbers, thingyPlus2Nums: winningthingyPlus2Numbers, drawDate:drawDate},
        // callback handler that will be called on success
        success: function (data) {
        }
    }); 
}
</script>

scrape_page.php

<?php

    include 'simple_html_dom.php';

    $html = file_get_html('http://www.site.com');
    $file = 'latest_results.txt';
    file_put_contents($file, $html);
?>

postToDB.php

<?php

$winningNums = $_POST['thingyNums'];
$winningPlus1Nums = $_POST['thingyPlus1Nums'];
$winningPlus2Nums = $_POST['thingyPlus2Nums'];
$drawDate = $_POST['drawDate'];

$thingyToSave = implode(',', $winningNums);
$plus1ToSave = implode(',', $winningPlus1Nums);
$plus2ToSave = implode(',', $winningPlus2Nums);

//CONNECT TO REMOTE
$con = mysql_connect("172.xx.xx.xx","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

//SELECT thingy DB
mysql_select_db("App", $con);

//CHECK IF DATE ALREADY EXISTS IN DB
$date_check = mysql_query("SELECT drawDate FROM thingy WHERE drawDate='$drawDate'");
$do_date_check = mysql_num_rows($date_check);

if($do_date_check > 0){
    //DATE ALREADY IN DB
    die("Entries already exist");
} else {
    mysql_query("INSERT INTO thingy (drawDate) VALUES ('$drawDate')");
    mysql_query("UPDATE thingy SET thingyRes = '$thingyToSave' WHERE drawDate = '$drawDate'");
    mysql_query("UPDATE thingy SET thingyPlus1Res = '$plus1ToSave' WHERE drawDate = '$drawDate'");
    mysql_query("UPDATE thingy SET thingyPlus2Res = '$plus2ToSave' WHERE drawDate = '$drawDate'");
    echo "Success";
}

mysql_close($con);
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:36:40+00:00Added an answer on June 15, 2026 at 7:36 am

    The script you’re trying to run contains Javascript – which is executed in a browser. Cron will execute the PHP script on the server, and send the output nowhere (as you’re directing it to /dev/null).

    There’s nothing in that scenario that will interpret and execute the Javascript.

    You need to essentially port the logic in your Javascript (which makes requests to the two related PHP scripts) to PHP. (You could possibly run some server side javascript interpreter/php extension, but in this case that would seem a bit crazy.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Cron installation is vixie-cron /etc/cron.daily/rmspam.cron #!/bin/bash /usr/bin/rm /home/user/Maildir/.SPAM/cur/*; I Have this simple bash script
I have a cron job the executes a PHP script. The cron is setup
I have cron jobs setup that runs a few PHP scripts often. The issue
EDIT: See my answer below--> I am wanting to have a view that when
Edit (updated question) I have a simple C program: // it is not important
I have a python script start.py that executes well from the command line. There
EDIT: I have completely changed the question. I want to use Amazon S3 for
I have this bash script on the server that runs every hour, via cron.
So, I set up a cronjob to run the following command: php /var/www/path/to/cron/do-stuff.php The
I have a CakePHP script that should hopefully be run by a cron job.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.