Jump to content

[PHP] Imageshack uploader

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
luruke

luruke

    Newbie

  • Members
  • PipPip
  • 26 posts
Small script for upload an image on imageshack using cURL
<?php
$filename = $argv[1] or die("Usage: $argv[0] filename\n");


   if(!file_exists(realpath($filename))) die("Il file non esiste.\n");
   $allow   = array('jpg','jpeg','png','gif','bmp','tif','tiff','pdf');
   if(!in_array(array_pop(explode('.',$filename)),$allow)) die("Estensione non permessa.\n");


   if(preg_match('#<input type="text" onClick="track\(\'direct\'\);highlight\(this\)" style="width: 500px" size="70" value="(.+?)"/>#',`curl -F "fileupload=@$filename" -A "ImageShack Uploader" -H "Expect:" load.imageshack.us`, $out)){
      print $out[1]."\n";
                //system('firefox $out[1]');
   } else {
      print "Errore\n";
   }
?>


#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Moved to the code section. Thanks for the share!

#3
luruke

luruke

    Newbie

  • Members
  • PipPip
  • 26 posts

Jordan said:

Moved to the code section. Thanks for the share!

thx, i'm sorry,
it will be for next time :)

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
No problem. Most people miss the code section. You might want to turn these code snippets into tutorials which will earn you +rep which will get you a free shirt: http://forum.codecal...irt-thread.html and http://forum.codecal...guru-satus.html

:)

#5
luruke

luruke

    Newbie

  • Members
  • PipPip
  • 26 posts
the t-shirt it's very awesome! i want it!
I imagine myself with this t-shirt at school! lol

#6
Brandon W

Brandon W

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,828 posts
hehe, I want to wear it to school :) Jordan, check the t-shirt thread hehe.

Simple code, but still does what is needed. There is a site that uploads to about 5 or 6 image hosting sites at once.
jQuery Selectors Tutorial - jQuery Striped Table tutorial - jQuery Events - jQuery Validation

Sorry if I don't post as often as I did, I'll try to get here as much as possible! I'm working my bum off to get this scholarship and other stuff!