Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //main feed daemon script
- //no execution limit
- set_time_limit(0);
- //include db class
- require_once('classes/db_helper.class.php');
- $dbClass = new DBHelper('localhost', 'datafeeds', 'vede7yvej', 'zadmin_datafeeds');
- //if not enough arguments found
- if ($argc <= 1) {
- //die('usage: php feed.php <startnum> <endnum> <gr_url> <gr_webformid> <gr_uid>'."\n"); # code...
- die('usage: php feed.php <client id>'."\n");
- }
- $client_id = $argv[1];
- $client = $dbClass->get_client($client_id)[0];
- //arguments
- $start_num = $client['startnum'];
- $end_num = $client['endnum'];
- $executionTime = time() + (24 * 60 * 60);
- $rand_num = rand($start_num, $end_num);
- $apikey="16e2404e101909b9d3c11333f902f7aa";
- $gr_url = $client['grapikey'];
- $gr_webformid = $client['grwebform'];
- $gr_uid = $client['gruid'];
- //create execution times, array
- $fmlarray = array();
- for ($x = 1; $x <= $rand_num; $x++)
- {
- $fml = rand(time(), $executionTime);
- //echo $fml."\n";
- $fmlarray[] = $fml;
- }
- sort($fmlarray);
- //output start and end time
- echo 'Start Time: '.time()."\n";
- echo 'End Time: '.$executionTime."\n";
- //set daily executions
- $dbClass->set_daily($client_id, $rand_num);
- $i = 0;
- //loop 24 hours
- while(time() < $executionTime) {
- //if current time is execution times array
- if(in_array(time(), $fmlarray)){
- $data = $dbClass->get_unassigned_by_api_key($apikey, 1);
- foreach($data as $d){
- $dbClass->set_assigned_by_email($d['email']);
- //api request
- $url = 'http://offerhq.info/postrequest.php?api_key=jonAPI2014&email='.$d['email'].'&fname='.$d['firstname'].'&lname='.$d['lastname'].'&offer_url='.$d['referal_url'].'&ip='.$d['ip'].'&ar=gr&gr_webformid='.$gr_webformid.'&gr_uid='.$gr_uid.'&ref_url='.$gr_url;
- file_get_contents($url);
- //increment total loaded by 1
- $dbClass->increment_total($client_id);
- echo '..::[ Added Subscriber #'.$i.' with APIKEY: '.$apikey.' and Email: '.$email.' ]::..'."\n";
- $i++;
- }
- }
- sleep(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement