1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need a quick PHP script done!

Discussion in 'Hire a Freelancer' started by mynameis940, Aug 19, 2012.

  1. mynameis940

    mynameis940 Power Member

    Joined:
    May 1, 2011
    Messages:
    520
    Likes Received:
    77
    Hello.

    I need a script in PHP done as soon as possible. It is very simple script, but I don't have any PHP knowledge to do it by myself.

    Please post your Skype details below, I'll add you to talk.

    More info about script:
    It should check a website which generates a random string each 10 seconds, store that string in a file and keep doing that each 10 seconds. And one more thing which will be explained via Skype.

    Thank you.
     
  2. criticalmess

    criticalmess Regular Member

    Joined:
    Feb 7, 2009
    Messages:
    237
    Likes Received:
    210
    sent you a PM, talk to me
     
  3. mynameis940

    mynameis940 Power Member

    Joined:
    May 1, 2011
    Messages:
    520
    Likes Received:
    77
    I added you, awaiting for accept.
     
  4. blackhatgalaxy

    blackhatgalaxy BANNED BANNED

    Joined:
    Dec 25, 2011
    Messages:
    245
    Likes Received:
    15
    add me on skype
    my id:soumyabishi
     
  5. monstertech6

    monstertech6 BANNED BANNED

    Joined:
    Apr 13, 2011
    Messages:
    1,057
    Likes Received:
    33
    add me in skype : vinod_vyas_dt
     
  6. Are you still looking for the PHP job to be done....
     
  7. Autumn

    Autumn Elite Member

    Joined:
    Nov 18, 2010
    Messages:
    2,197
    Likes Received:
    3,044
    Occupation:
    I figure out ways to make money online and then au
    Location:
    Spamville
    Looks like the target site is down (maybe too many people abusing it?), but here's the script if you still want it. No charge.

    PHP:
    <?php

    /*************************************************************************\
    uploadnsell_bot.php

    Edit the variables at the top of the script and then run from command line.

    If you want to watch the output:
    $ php -q uploadnsell_bot.php 

    If you want to leave running in background:
    $ php -q uploadnsell_bot.php > log_file.txt &

    If you are watching the output, to kill the script just press ctrl+C.  If
    you are running it in the background and you want to kill it, find the
    process in the process list with ps:
    $ ps x
    and then kill that process id number eg.
    $ kill <processid>


    Author:   [email protected]
    Created:  Sun Aug 19 16:46:44 ICT 2012
    Last mod: 
    \*************************************************************************/

    // Fill in these vars

    // Seconds to wait between fetches
    $wait 10;

    /*****************************************************************************\
    If you want to view the results through a web page, set this to a directory
    within one of your domains eg. /var/www/yourdomain.com/the_output_dir

    If that directory is owned by a different user than the user that is running
    this php script, eg. if you are running this as your local user on the command
    line but the apache dir is owned by the apache user, you may have to chmod the
    output_dir to 0777 so this script can write to the output_dir
    \*****************************************************************************/

    // Output dir
    $output_dir 'output';

    // Full path to gocr - leave blank if you don't want to use gocr
    // It doesn't work very well because the email gif is partially obfuscated
    // If you have gocr installed, you can find the path by using the CLI command
    // which gocr
    $gocr_path '/opt/local/bin/gocr';

    // Download the product?  Can be yes or no
    // This could slow the script down substantially because the script has to wait
    // for all the file to download before it can continue to the next loop.
    // There could be some large files being downloaded which could cause bandwith
    // and storage usage issues.  If a file has already been downloaded, it won't
    // be downloaded again.
    $download_product 'yes';

    // Same permissions stuff applies to download_dir as does to output_dir
    $download_dir     'downloads';






    /*****************************************************************************/

    /* DON'T EDIT BELOW HERE */


    // Make output dirs
    @mkdir($output_dir0755);
    @
    mkdir($download_dir0755);


    // Loop until manually killed
    while($stop 1) {

        
    $date date('Ymd_His');

        
    $save_dir "$output_dir/$date";
        
    mkdir($save_dir0755);


        unset(
    $html);
        unset(
    $dl_page_url);
        unset(
    $code);
        unset(
    $product_name);
        unset(
    $purchased_date);
        unset(
    $price);
        unset(
    $contact_person);
        unset(
    $company);
        unset(
    $support_email);
        unset(
    $email);
        unset(
    $email_gif);
        unset(
    $download_urls);
        unset(
    $filenames);
        unset(
    $downloads_summary);


        
    /*****************************************************************************/
        // Add random var to get around caching
        
    $x mt_rand(1999999);
        
    $check_sale_url "http://uploadnsell.com/check-sale.php?blahblah=$x";
        echo 
    "Fetching $check_sale_url... ";
        if(
    $html file_get_contents("http://uploadnsell.com/check-sale.php?blahblah=$x")) {
            
    $code trim($html);
            echo 
    "OK\nCode: $code\n";

            
    $fh fopen("$save_dir/1.html"'w');
            
    fwrite($fh$code);
            
    fclose($fh);

        } else {
            echo 
    "FAIL\nERROR: Could not fetch check-sale.php\n";
            
    sleep($wait);
            continue;

        }



        
    /*****************************************************************************/
        
    $dl_page_url "http://uploadnsell.com/download/$code/";
        echo 
    "URL: $dl_page_url\n";
        echo 
    "Fetching download page...";
        if(
    $html file_get_contents($dl_page_url)) {
            echo 
    "OK\n";

            
    $fh fopen("$save_dir/2.html"'w');
            
    fwrite($fh$html);
            
    fclose($fh);

        } else {
            echo 
    "FAIL\nERROR: Could not download download page, url '$dl_page_url'\n";
            
    sleep($wait);
            continue;

        }



        
    /*****************************************************************************/
        ###########################
        # EXTRACTING PRODUCT_NAME #
        ###########################

        
    echo "Extracting product_name\n";

        if(
    preg_match('/Product Name: <\/b> ([^<]*)<br>/'$html$regs)) {
            
    $product_name $regs[1];
            echo 
    "Token: $product_name\n";
        } else {
            echo 
    "ERROR: Could not extract $product_name\n";
        }



        
    /*****************************************************************************/
        ####################
        # EXTRACTING PRICE #
        ####################

        
    echo "Extracting price\n";

        if(
    preg_match('/Price: <\/b> ([^<]*)<br>/'$html$regs)) {
            
    $price $regs[1];
            echo 
    "Token: $price\n";
        } else {
            echo 
    "ERROR: Could not extract $price\n";
        }



        
    /*****************************************************************************/
        #############################
        # EXTRACTING PURCHASED_DATE #
        #############################

        
    echo "Extracting purchased_date\n";

        if(
    preg_match('/Purchased Date: <\/b> ([^<]*)<br>/'$html$regs)) {
            
    $purchased_date $regs[1];
            echo 
    "Token: $purchased_date\n";
        } else {
            echo 
    "ERROR: Could not extract $purchased_date\n";
        }



        
    /*****************************************************************************/
        ######################
        # EXTRACTING COMPANY #
        ######################

        
    echo "Extracting company\n";

        if(
    preg_match('/Company: <\/b> ([^<]*)<br>/'$html$regs)) {
            
    $company $regs[1];
            echo 
    "Token: $company\n";
        } else {
            echo 
    "ERROR: Could not extract $company\n";
        }



        
    /*****************************************************************************/
        #############################
        # EXTRACTING CONTACT_PERSON #
        #############################

        
    echo "Extracting contact_person\n";

        if(
    preg_match('/Contact Person: <\/b> ([^<]*)<br>/'$html$regs)) {
            
    $contact_person $regs[1];
            echo 
    "Token: $contact_person\n";
        } else {
            echo 
    "ERROR: Could not extract $contact_person\n";
        }



        
    /*****************************************************************************/
        ############################
        # EXTRACTING SUPPORT_EMAIL #
        ############################

        
    echo "Extracting support_email\n";

        if(
    preg_match('/<b>Support Email: <\/b> <img align="absmiddle" src="([^"]*)"><br>/'$html$regs)) {
            
    $support_email $regs[1];
            echo 
    "Token: $support_email\n";
        } else {
            echo 
    "ERROR: Could not extract $support_email\n";
        }

        echo 
    "Downloading email gif... ";
        if(
    $gif file_get_contents($support_email)) {
            echo 
    "OK\n";

            
    $fh fopen("$save_dir/email.gif"'w');
            
    fwrite($fh$gif);
            
    fclose($fh);

        } else {
            echo 
    "FAIL\nERROR: Could not download email gif\n";

        }


        
    // Attempt to solve email address
        
    if(!empty($gocr_path)) {
            
    $email exec("gocr $save_dir/email.gif");
            
    $email trim($email);
            echo 
    "Email: $email\n";
            
    $email "\nemail|$email";
        }




        
    /*****************************************************************************/
        ###########################
        # EXTRACTING DOWNLOAD_URL #
        ###########################

        
    echo "Extracting download_urls and filenames\n";

        
    preg_match('/div class=\'linkbox\'><ul>(.*)<\/ul>\s*<a id="facebookbtn-link"/imsU'$html$regs);

        
    $files_chunk $regs[1];
        
    $files_chunk preg_replace('/<\/div>/'''$files_chunk);
        
    $files_chunk preg_replace('/></'">\n<"$files_chunk);
        
    $files_chunk preg_replace("/<li>\n?/"''$files_chunk);
        
    $files_chunk preg_replace("/<\/li>\n?/"''$files_chunk);
        
    $files_chunk trim($files_chunk);
        
    //echo "$files_chunk\n";

        
    $files explode("\n"$files_chunk);
        foreach(
    $files as $file) {
            
    preg_match('/<a href="([^"]*)">([^<]*)<\/a>/'$file$regs);
            
    $download_urls[] = $regs[1];
            
    $filenames[] = $regs[2];
        }

        echo 
    "Download urls:\n";
        
    print_r($download_urls);
        echo 
    "Filenames:\n";
        
    print_r($filenames);

        
    $count count($download_urls);
        for(
    $i 0$i $count$i++) {
            
    $j $i 1;
            
    $downloads_summary .= "download$j|{$download_urls[$i]}|{$filenames[$i]}\n";
        }


        if(
    $download_product == 'yes') {
            echo 
    "Downloading $count product(s)...\n";

            
    // Get list of already downloaded files
            
    $already_downloaded = array();

            
    $dh opendir($download_dir);
            while(
    $fn readdir($dh)) {
                if(
    $fn == '.' || $fn == '..') {
                    
    // ignore
                
    } else {
                    
    $already_downloaded[] = $fn;
                }
            }
            
    closedir($dh);
            
            
    $count count($download_urls);
            for(
    $i 0$i $count$i++) {
                if(
    in_array($filenames[$i], $already_downloaded)) {
                    echo 
    "{$filenames[$i]} has already been downloaded, skipping\n";
                } else {
                    echo 
    "Downloading: {$filenames[$i]}... ";
                    if(
    $html file_get_contents($download_urls[$i])) {
                        echo 
    "OK\n";

                        
    $fh fopen("$download_dir/{$filenames[$i]}"'w');
                        
    fwrite($fh$html);
                        
    fclose($fh);

                    } else {
                        echo 
    "FAIL\nERROR: Could not download product\nURL: {$download_urls[$i]}\nFilename: {$filenames[$i]}\n";

                    }
                }
            }

        }


        
    /*****************************************************************************/
        
    $file "time|$date
    code|
    $code
    url|
    $dl_page_url
    product_name|
    $product_name
    price|
    $price
    purchased_date|
    $purchased_date
    contact_person|
    $contact_person
    company|
    $company
    support_email|
    $support_email$email
    $downloads_summary
    "
    ;

        echo 
    "\nSummary:\n\n$file\n\n";

        
    $fh fopen("$save_dir/data.txt"'w');
        
    fwrite($fh$file);
        
    fclose($fh);

        
    sleep($wait);

    }

    ?>