CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2012
    Posts
    1

    Vbulletin/Rssposter.php Need it to run without Cronimage,

    Hiya

    I've been at this for days, posting on vbulletin.org & vbulletin.com trying to get a resolution, but theres no joy.

    Heres what I'm after
    On vbulletin, I have a rssposter which pulls rss feeds and automatically posts them as a thread. This is brilliant but it only runs the task when a user enters the forum and triggers the cronimage file. I want it to run without the need of a user to trigger it. I would like it to run say every 30min indefinite.

    So i've set up a cron job on my server, to run this cron file, which runs the rssposter, but it still doesn't work. I don't know whether its the cron coding, or my server messing things up. Heres the code:


    PHP Code:
     // ####################### SET PHP ENVIRONMENT ###########################
     
    error_reporting(E_ALL & ~E_NOTICE);
     
    ignore_user_abort(1);
     @
    set_time_limit(0);

     
    // #################### DEFINE IMPORTANT CONSTANTS #######################
     
    define('SKIP_SESSIONCREATE'1);
     
    define('NOCOOKIES'1);
     
    define('THIS_SCRIPT''cron');
     
    define('CSRF_PROTECTION'true);

     
    // #################### PRE-CACHE TEMPLATES AND DATA ######################
     // get special phrase groups
     
    $phrasegroups = array();

     
    // get special data templates from the datastore
     
    $specialtemplates = array();

     
    // pre-cache templates used by all actions
     
    $globaltemplates = array();

     
    // pre-cache templates used by specific actions
     
    $actiontemplates = array();

     
    // ######################### REQUIRE BACK-END ############################
     
    require_once('./global.php');
     require_once(
    DIR '/includes/functions_cron.php');

     
    // #######################################################################
     // ######################## START MAIN SCRIPT ############################
     // #######################################################################
     
    $filedata vb_base64_decode('R0lGODlhAQABAIAAAMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
     
    $filesize strlen($filedata);

     
    // browser will think there is no more data if content-length is what is returned
     // regardless of how long the script continues to execute, apart from IIS + CGI

     
    header('Content-type: image/gif');

     if (!(
    strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false AND strpos(SAPI_NAME'cgi') !== false))
     {
     
    header('Content-Length: ' $filesize);
     
    header('Connection: Close');
     }

     if (!
    $vbulletin->options['crontab'])
     {
     echo 
    $filedata;
     
    flush();
     }

     (
    $hook vBulletinHook::fetch_hook('cron_start')) ? eval($hook) : false;

     
    exec_cron(17);
     
    $db->close();
     }
     } 

    If anyone could help me out, i would much appreciate it. Or if anyone else could give me a solution to the task I want to create. I would be most greatful

    Thanks for reading

    Lukescotty
    Last edited by PeejAvery; April 23rd, 2012 at 02:06 PM. Reason: Added PHP tags

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Vbulletin/Rssposter.php Need it to run without Cronimage,

    If it works when the user triggers it through loading a file, but not through the cron job then there are only 2 possible reasons...

    • User privileges in the cron job
    • Incorrect cron job setup
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured