by Phil
10 replies
Hi,

I regularly visit a site which publishes a text list every couple of hours. The text file is at the same address every time, but the content is renewed every few hours. Currently, I just go there and download it every time I remember but it would be very useful to automate this - anyone have any suggestions how to do that?

I have an autoclicker, but that would mean setting it up on a separate computer and having the browser in the front the whole time. There must be something that can do this behind the scenes and with low resources?

All that needs to happen is to visit a URL every hour or so. Then save/download the text file also.
#automate #task
  • Profile picture of the author Mkj
    You should be able to do this by creating 2 files. 1st file should have this content:

    <html>
    <head>
    <title>Get File Contents From Url</title>
    <style type="text/css">
    body {
    font-size: 10px;
    font-family: arial;
    margin: 0px;
    padding: 0px;
    }
    </style>
    </head>
    <body>

    <?php


    $data = file_get_contents('url to text file here');


    $file= fopen("url_contents.txt", "w");
    fwrite($file, $data);
    fclose($file);

    echo "Text File Updated!";

    ?>
    </body>
    </html>

    Create number 2 file 'url_contents.txt' and place in the same directory, making sure it is fully writable - 0777 permissions.

    The above 2 files will get the text file contents and print it out. You can refresh the contents by using either meta tags refresh code like this:

    <meta http-equiv="Refresh"
    content="time in seconds here; URL=above file location here">

    with the above placed just under the <head> tag or you could use php refresh such as this:

    header( 'refresh: time in seconds here; url=
    above file location here' );

    You adjust the times in seconds to suit your refresh rate. Open the url to the file in your browser and minimize it to your task bar and leave it run. Another option would be to use a free cron service and get them to refresh the url every so often - probably a lot better and reliable way to do it.

    Free cron jobs google search:
    http://www.google.co.uk/#sclient=psy...64042ba2cabeca
    {{ DiscussionBoard.errors[3930251].message }}
  • Profile picture of the author slight
    If this on your desktop PC, you'll probably want something like wget, run it in a batch file and add it to your scheduled task.
    {{ DiscussionBoard.errors[3930262].message }}
    • Profile picture of the author Mkj
      Originally Posted by slight View Post

      If this on your desktop PC, you'll probably want something like wget, run it in a batch file and add it to your scheduled task.
      Must admit that sounds like a much better way of doing it.
      {{ DiscussionBoard.errors[3930290].message }}
  • Profile picture of the author Phil
    Thanks a bunch, guys.

    Wget looks and sounds great. Never heard of it before now. But after half an hour or more trying to figure out how to use it, and failing, I decided simply to follow MKJ's isntructions and get the job done.

    Thanks to you both.
    Phil
    {{ DiscussionBoard.errors[3930417].message }}
    • Profile picture of the author Mkj
      Not sure I have answered this question correctly for you. My method really was for you to get the text file contents and make it available to add to another website page using php include. If on the other hand you just want to view a particular website page - the text file page - regularly then all you would need to do is use iframes.

      Create a page with this content:

      <html>

      <head>
      <meta http-equiv="Refresh"
      content="time in seconds here; URL=url of this file here">
      <title>Text Update</title>
      </head>
      <body>
      <h3>Text Update</h3>
      <iframe src="url of the text file here" frameborder="0" width="width here" height="height here"></iframe>
      </body>
      </html>

      The above will refresh the offsite text file you mentioned.

      You would point your browser to the above created file and leave it run.
      {{ DiscussionBoard.errors[3930462].message }}
  • Profile picture of the author website12
    Banned
    I can help you with the batch scrpit if you need help just email at allicali.magic@gmail.com
    {{ DiscussionBoard.errors[3930434].message }}
  • Profile picture of the author Phil
    The URL goes to the file itself. So when you visit the URL, the file download window appears.

    I've just set up the files as described but what it does is open the file download window, not record the content of the file.
    {{ DiscussionBoard.errors[3930480].message }}
  • Profile picture of the author Clyde
    Something like uBot or zennoposter should work for this.
    Signature

    Generate Unlimited Number of Micro Niche Keywords, Multi-threaded EMD Finder PLUS More!




    50% OFF WSO.
    {{ DiscussionBoard.errors[3930496].message }}
    • Profile picture of the author Mkj
      The URL goes to the file itself. So when you visit the URL, the file download window appears.

      I've just set up the files as described but that doesn't seem to work.
      I haven't read your question fully or properly I don't think. I thought you wanted a file to add to an existing website - which you don't by the looks of it. The wget option seems the way to go as this would automatically get the file contents for you and show them on your desktop - which is what you wanted by the looks of it. I think you can ignore any of my posts as these are not fully addressing your needs.
      {{ DiscussionBoard.errors[3930513].message }}
      • Profile picture of the author Mkj
        Can you post the link to the text file? I have a method now that will allow you to create a bookmark and download the contents as if it is a zip file. The file will open automatically without needing to be unzipped.
        {{ DiscussionBoard.errors[3930628].message }}

Trending Topics