PHP Script Suggestion

Discussion in 'PHP' started by primster7, Aug 28, 2016.

  1. #1
    Hello,

    I have a custom script that runs when I click a link to make it run. The script then displays items on a single webpage.

    I need to know if there is a pretty easy way to make it so that it takes the results and emails it to me as a .txt file or other file.

    Any suggestions would be greatly appreciated.
     
    primster7, Aug 28, 2016 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Probably. Without seeing the script, it's hard to say, but since it's already outputting this to a webpage, it should be possible to just do that and put that information into a message-body, and email it to a set email. Since you will be the only one receiving it, it can be hardcoded into the script, and shouldn't really be that hard to do. However, it depends a bit on how the current script is coded. If it's simple, adding an email via sendmail at the bottom of the script should be easy. Just look up "sending mail via php" or something on Google -there are tons of tutorials available. True, most of them will be for contact forms or similar, but should be relatively easy to transform.
     
    PoPSiCLe, Aug 28, 2016 IP
    sarahk likes this.
  3. pagecoder

    pagecoder Banned

    Messages:
    61
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    45
    #3
    well, ya, you have to save those query results into another variable and send it via mail function. but if there are pictures associated with items you have to use absolute urls of those pictures in email message.
    I assumed that results are coming from database.
     
    pagecoder, Oct 5, 2016 IP
  4. Einheijar

    Einheijar Well-Known Member

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    3
    Trophy Points:
    165
    #4
    You'll probably want to look at the commands
    ob_start();
    ob_get_contents();
    ob_end_flush();

    That way you can get your page HTML without extraneous code
     
    Einheijar, Oct 5, 2016 IP