Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 5 of 5

This is a discussion on Cron Job adds extra html in the Shared & Semi-Dedicated forum
I have a cron job that writes a html file, but it adds the following html to the top of the file. I need to ...

  1. #1
    Aletia Customer
    Join Date
    Oct 2001
    Posts
    631

    Cron Job adds extra html

    I have a cron job that writes a html file, but it adds the following html to the top of the file. I need to be able to remove it so the page will validate. Anyone know how to either remove it automatically, or prevent the cron job from writing it in the first place?

    Code:
    Content-type: text/html
    X-Powered-By: PHP/4.3.4

  2. #2
    Ron
    Guest
    I assume this is happening because you're using php in the cron job? You could run another script over the created file to strip it off, call the script at the end of the php script.

    Part of the problem with helping you on this one, is I'm not sure how php will work from the command line -- I've never used it that way. Do you explicitly open an output file, or are you relying on php to just create as it's output an html file?

    If you have explicitly created the file, then you could just make a system call from inside the php script to do this...
    Code:
     mv [file1] [file2]; egrep -v "Content-type|X-Powered-By" [file2] > [file1]
    Otherwise, you'll have to have a second job run over the file, or before "validation" as you called it, you can do this. Better yet, you could just do something like...
    Code:
    egrep -v "Content-type|X-Powered-By" [file1] | [validation program]
    Sorry I can't be much more help without seeing the code/circumstance

  3. #3
    Ron
    Guest
    Scratch all that, call php with -q to suppress the headers

  4. #4
    Ron
    Guest
    I usually use this manual online:
    http://www.php.net/manual/en/features.commandline.php

    But this time there was a much more succinct and on-point description here:
    http://aspn.activestate.com/ASPN/doc...mmandline.html

  5. #5
    Aletia Customer
    Join Date
    Oct 2001
    Posts
    631
    Hey, that was simple, and it worked perfectly. Thanks for the info. By the way, there is no validation program. I'm just talking about being able to put the little valid xhtml logo on my page.

Bookmarks

Posting Permissions

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