I have a php file(index.php) which calls another file(ajax.php), which consists of javascript and ajax calls.
index.php, $mid
is a variable fetched from database:
<?php
$url = "http://localhost/parser/ajax.php?m=$mid";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_exec($ch);
ajax.php :
<?php
$mid = $_GET["mid"];
var r = {
feedLife: 60,
feedParams: {
competition: '129',
season: SEASON,
sport: SPORT,
match: <?php echo $mid ?>,
}
};
$.ajax({
url: 'upload_json.php?m=<?php echo $mid ?>',
dataType: 'json',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify(a),
processData: false,
success: function(){
},
error: function( jqXhr, textStatus, errorThrown ){
console.log( errorThrown );
}
});
I want to run a cron, but as console can not parse javascript, I have no idea how to achieve automation? Any ideas? Maybe phantomJS can do a trick?
thanks in advance