PHP cron job file download

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JS

    PHP cron job file download

    I go to a website once a week to download public data. Upon submitting
    a form, a text file is producted and I get the usual Windows dialog
    box asking if I would like to open or save the text file locally. I
    save it locally.

    I am thinking about setting up a php script on an Apache server I use
    to host some websites. Basically, I would like the script (which is
    nothing more than a pre-populated form) to run as a cron job, get the
    text file and then email it to me.

    My questions: (1) Is this possible and (2) If so, if the form is
    submitted from the server, where does it get saved? And what will it
    be named?

    Thanks, J

    [Please don't email me. This is my no-spam address.]
  • gmuldoon

    #2
    Re: PHP cron job file download

    joesalt@ireland .com says...[color=blue]
    > I go to a website once a week to download public data. Upon submitting
    > a form, a text file is producted and I get the usual Windows dialog
    > box asking if I would like to open or save the text file locally. I
    > save it locally.
    >
    > I am thinking about setting up a php script on an Apache server I use
    > to host some websites. Basically, I would like the script (which is
    > nothing more than a pre-populated form) to run as a cron job, get the
    > text file and then email it to me.
    >
    > My questions:[/color]
    [color=blue]
    > (1) Is this possible[/color]

    Yes.
    [color=blue]
    > (2) If so, if the form is
    > submitted from the server, where does it get saved? And what will it
    > be named?[/color]

    Don't use your existing form.

    Write a separate PHP script to be run by the cron that just creates a
    temporary file rather than saving it on the server, use a date stamp in
    the file name that you use to attach it to your email.

    Geoff M

    Comment

    • thumb_42@yahoo.com

      #3
      Re: PHP cron job file download

      JS <joesalt@irelan d.com> wrote:[color=blue]
      > I am thinking about setting up a php script on an Apache server I use
      > to host some websites. Basically, I would like the script (which is
      > nothing more than a pre-populated form) to run as a cron job, get the
      > text file and then email it to me.[/color]

      I'd seriously consider another language (or even another tool) for this
      task. curl, wget are decent tools for this type of thing. lynx is so-so
      (but if you don't have curl or wget it may be better than nothing)

      Failing that, I'd use perl and LWP.

      I'm not slamming PHP, but using it for batch procesing is kind of like
      using a car to knock down a building. Yea, it might work, but a
      bulldozer would be better. :-)

      Jamie

      Comment

      • Tim Van Wassenhove

        #4
        Re: PHP cron job file download

        In article <T4Vfc.4539$0b4 .14073@attbi_s5 1>, thumb_42@yahoo. com wrote:[color=blue]
        > JS <joesalt@irelan d.com> wrote:[color=green]
        >> I am thinking about setting up a php script on an Apache server I use
        >> to host some websites. Basically, I would like the script (which is
        >> nothing more than a pre-populated form) to run as a cron job, get the
        >> text file and then email it to me.[/color]
        >
        > I'd seriously consider another language (or even another tool) for this
        > task. curl, wget are decent tools for this type of thing. lynx is so-so
        > (but if you don't have curl or wget it may be better than nothing)[/color]

        curl http://foo | mail bar@invalid

        might want to lookup what -d does with curl

        --

        Comment

        Working...