function cron_events() { include 'scrapers/curl_new_events.php'; //Check thru the ones that were previosly not displayed $not_displayed_posts = get_option('posts_not_displayed'); if (!empty($not_displayed_posts)) { //$not_displayed_posts = ''; //print_r($not_displayed_posts); $posts_not_displayed = ''; foreach ($not_displayed_posts as $not_displayed_post) { $post_id = $not_displayed_post; //echo '<br />ID: ' . $post_id; $url = 'http://www.prescott-az.gov/events/index.php?id=' . $post_id; $status = curl_event_scrape($url, $post_id); //print_r($status); if ($status[1] == true) { //echo $status[0] . ' was posted'; } if ($status[1] == false && !empty($status[0])) { //echo $status[0] . ' was NOT posted'; $posts_not_displayed[] = $status[0]; //print_r($posts_not_displayed); } } } if (empty($posts_not_displayed)) { $posts_not_displayed = array(); } $post_id = get_option('latest_event_id'); if (empty($post_id)) { $post_id = 10002; } $post_id = $post_id + 1; $post_end = $post_id + 10; while ($post_id < $post_end) { if (in_array($post_id, $posts_not_displayed)) { $post_id++; continue; } //echo '<br />ID: ' . $post_id; $url = 'http://www.prescott-az.gov/events/index.php?id=' . $post_id; $status = curl_event_scrape($url, $post_id); //print_r($status); if ($status[1] == true) { //echo $status[0] . ' was posted'; } if ($status[1] == false && !empty($status[0])) { //echo $status[0] . ' was NOT posted'; $posts_not_displayed[] = $status[0]; //print_r($posts_not_displayed); } $post_id++; } update_option('posts_not_displayed', $posts_not_displayed); //print_r($posts_not_displayed); }
$post_id = $_POST['post_id']; $post_end = $_POST['post_end']; if (empty($post_id)) { $post_id = 10500; } if (empty($post_end)) { $post_end = $post_id + 100; } while ($post_id <= $post_end) { echo 'postid: ' . $post_id; if (in_array($post_id, $posts_not_displayed)) { $post_id++; continue; } $url = 'http://www.prescott-az.gov/events/index.php?id=' . $post_id; $status = curl_event_scrape($url, $post_id); if ($status[1] == true) { } if ($status[1] == false && !empty($status[0])) { $posts_not_displayed[] = $status[0]; } $post_id++; } //update_option( 'posts_not_displayed', $posts_not_displayed ); } else { // If Not submitted ?> <?php global $network_admin, $form_action; $network_admin = 0; ?>