Results 1 to 1 of 1
  1. #1
    casino2k.com's Avatar
    casino2k.com is offline Private Member
    Join Date
    January 2008
    Location
    Milano
    Posts
    342
    Thanks
    136
    Thanked 64 Times in 49 Posts

    Default Script to check automatically thieves with copyscape

    Hello Folks,
    I have released two scripts written in php to check content thieves automatically. They're very similar: the first is intended to be run on a shell, the second on a webserver.

    To run them, you need a copyscape Premium account: each search costs $0.05; after signup they give you a API KEY to access remotely their service.
    You also need to put the list of URLs in a file (one per line), and specify the filename in the configuration part of the script.
    Check the FAQ on the script for additional details.
    Before running the script against tons of URLs, I suggest to try with a few pages (maybe duplicate pages to check if it works). If you get an empty result set, it means no one has already copied you

    1) Select all the code and save it into a file called copyscape-shell.php
    Use this from command line:
    Code:
    php copyscape-shell.php
    The results will be saved in a file (default is copyscape-results.html): you can open it in a browser and see who copied you.

    PHP Code:
    <?php
    /*
    @VERSION: beta 0.1
    @AUTHOR: casino2k.com

    This version is intended for use in a shell, but may also be used in a webserver. The results will be saved in the file you specify in the configuration in html format.

    WARNING, THIS CODE IS PROVIDED "AS IS"

    If you like this script of find it very useful, please donate!

    Please EDIT the first part of the script!!!!

    To use this, you need a copyscape Premium Account.

    ------ FAQ --------
    Q: can I redistribute this script ?
    A: you shouldn't yet, it's not complete and only for personal use

    Q: how do I get my API key ?
    A: signup for a premium account at copyscape.com

    Q: why not using copysentry which automatically monitors my web pages?!?
    A: because it's more expensive, and maybe you don't need to check every week...

    Q: how do I create a list of files to check?
    A: go to xml-sitemaps.com , enter the FULL url of your website, Download Sitemap in Text Format (usually called urllist.txt)

    Q: how do I donate to you?
    A: <a title="Casino Online" href="http://www.casino2k.com">Casino Online</a>
     ------ END FAQ --------
    For any question or suggestion contact me through my website
    */

    //----------------- EDIT THIS!!! --------------------------
    $username=""// Your Copyscape username
    $api_key=""// Your API KEY
    $url_list=""// the name of the file with url list to check (one URL per line)
    $output_file="copyscape-results"// An output file. NOTE: if it doesn't exist, it will be created. If it already exists, the new results will be appended at the end of the old file.
    //-----------------  END EDIT!!! --------------------------

    if($username=="" || $api_key=="" || $url_list=="" || $output_file=="")
            die(
    "Please edit the file before running!\n");
    $fh fopen($url_list"r");
    if(
    $fh==false)
            die(
    "Unable to open the file for reading... Is \"url_list\" ok?!?\n");
    $format="html"// xml or html
    $operation="csearch"// name of operation, default
    $output_file.=".".$format;
    $out fopen($output_file"a+");
    if(
    $out==false)
            die(
    "Unable to open the output file for writing... Is \"output_file\" ok?!? Do you have write permission?!?\n");
    fwrite($out"<html><head><title></title></head><body>\r\n\r\n<br /><br />BETA Script made by <a title=\"Casino Online\" href=\"http://www.casino2k.com\">www.casino2k.com Casino Online</a><br /><br />Copyscape Report. Date: " date("Y/m/d") . "\r\n<br />" );
    $i=0;
    while (!
    feof($fh)) {
            
    $line fgets($fh);
            
    $copyscape_url "http://www.copyscape.com/api/?u=".urlencode($username)."&k=".urlencode($api_key)."&o=".urlencode($operation)."&f=".urlencode($format)."&q=".urlencode($line);
            
    fwrite($out, ++$i.") URL CHECKED: ".$line."\r\n<br />URL accessed: ".$copyscape_url."\r\n<br />RESULTS:\r\n<br />");
            
    fwrite($outfile_get_contents($copyscape_url) . "\r\n\r\n<br /><br />");
    }
    fwrite($out"</body></html>");
    fclose($fh);
    fclose($out);
    ?>
    2) Alternatively, use this in your webserver.
    Copy the php code in a file called copyscape-webserver.php, upload it (and the file containing the URLs), access the php file with your browser. The output will be printed in your browser in html format, you can save it if you want

    If you get this warning:
    Code:
    "URL file-access is disabled...."
    you must edit php.ini and set
    Code:
    allow_url_fopen = on
    After using the script, set allow_url_fopen back to the original value (for security purposes)!

    PHP Code:
    <?php
    /*

    @VERSION: beta 0.1
    @AUTHOR: casino2k.com

    NOTE:
    this version is intended for use on a webserver; upload this file and the file containing the URLs to be checked in the same directory.

    !!!! WARNING:  to use this script on a webserver you must edit your php.ini and set:
    allow_url_fopen = on
    !!!! Be careful, these settings could lead to remote file inclusion vulnerabilities, disable them (set back to off) after using the script!!!!

    WARNING, THIS CODE IS PROVIDED "AS IS"

    If you like this script of find it very useful, please donate!

    Please EDIT the first part of the script!!!!

    To use this, you need a copyscape Premium Account.

    ------ FAQ --------
    Q: can I redistribute this script ?
    A: you shouldn't yet, it's not complete and only for personal use

    Q: how do I get my API key ?
    A: signup for a premium account at copyscape.com

    Q: why not using copysentry which automatically monitors my web pages?!?
    A: because it's more expensive, and maybe you don't need to check every week...

    Q: how do I create a list of files to check?
    A: go to xml-sitemaps.com , enter the FULL url of your website, Download Sitemap in Text Format (usually called urllist.txt)

    Q: how do I donate to you?
    A: <a title="Casino Online" href="http://www.casino2k.com">Casino Online</a>

    For any question or suggestion contact me through my website
    */

    //----------------- EDIT THIS!!! --------------------------
    $username=""// Your Copyscape username
    $api_key=""// Your API KEY
    $url_list=""// the name of the file with url list to check (one URL per line)
    //-----------------  END EDIT!!! --------------------------

    if($username=="" || $api_key=="" || $url_list=="")
            die(
    "Please edit the file before running!\n");
    $fh fopen($url_list"r");
    if(
    $fh==false)
            die(
    "Unable to open the file for reading... Is \"url_list\" ok?!?\n");
    $format="html"// xml or html
    $operation="csearch"// name of operation, default
    print "<html><head><title></title></head><body>\r\n\r\n<br /><br />BETA Script made by <a title=\"Casino Online\" href=\"http://www.casino2k.com\">www.casino2k.com Casino Online</a><br /><br />Copyscape Report. Date: " date("Y/m/d") . "\r\n<br />";
    $i=0;
    while (!
    feof($fh)) {
            
    $line fgets($fh);
            
    $copyscape_url "http://www.copyscape.com/api/?u=".urlencode($username)."&k=".urlencode($api_key)."&o=".urlencode($operation)."&f=".urlencode($format)."&q=".urlencode($line);
            print ++
    $i.") URL CHECKED: ".$line."\r\n<br />URL accessed: ".$copyscape_url."\r\n<br />RESULTS:\r\n<br />";
            print 
    file_get_contents($copyscape_url) . "\r\n\r\n<br /><br />";
    }
    print 
    "</body></html>";
    fclose($fh);
    ?>
    I hope this script will be useful to you!!
    Matteo Casino2K

  2. The Following 3 Users Say Thank You to casino2k.com For This Useful Post:

    kwblue (16 December 2008), thepoisons (29 December 2008)

Posting Permissions

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