Skip to content
WJunction - Webmaster Forum

PHP CURL LulzImg Uploader

Status
Not open for further replies.
PHP CURL LulzImg Uploader

I started learning PHP and decided to share with you my first script:

PHP:
<?php

    /* 
        PHP CURL LulzImg Uploader
        @author: heppinnz
        @site: http://musicdl.org/
    */

    $file = $argv[1];
    $link = $argv[2];

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 5.1; rv:6.0.1) Gecko/20100101 Firefox/6.0.1");
    curl_setopt($ch, CURLOPT_URL, "http://lulzimg.com/app.php");
    curl_setopt($ch, CURLOPT_POST, true);
        $post = array(
            "image" => "@".$file,
            "uploadtype" => "image",
            "submit" => ""
        );
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    $result = curl_exec($ch);
    curl_close($ch);
    
    file_put_contents($link, $result);

    echo 'Image Uploaded to Lulzimg.com';
    
?>

Usage:
Code:
php lulzimg.php image.jpg link.txt

Have a Nice Day !!!
 

2 comments

Good job. However, what you've coded is a script that can only be called from command line. You could code another that can actually be used via a normal browser call. Use the $_GET server vars to get the data (or $_POST if you plan on expanding it) and upload to the app.php ;)
 
Good job. However, what you've coded is a script that can only be called from command line. You could code another that can actually be used via a normal browser call. Use the $_GET server vars to get the data (or $_POST if you plan on expanding it) and upload to the app.php ;)

thank you ! I'll think about your proposal in the next version :)
 
Status
Not open for further replies.

About the author

H
Active Member · Joined
94
Messages
2
Reactions
8
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom