Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl # Send2VCL - v0.2 use Socket; # setup $f=$ARGV[0]; $type="application/octet-stream"; $dir=$ARGV[1]; $dir="." unless($dir); $type="image/gif" if($f=~/\.gif$/i); $type="image/jpeg" if($f=~/\.jpg/i); print STDERR "--- Sending $f to VCL/$dir\n"; $fi=$f; $fi =~ s#^.+/([^/]+)$#$1#; # Connect $iaddr = inet_aton("") || die "Can't resolve VCL: $!"; $paddr = sockaddr_in(80, $iaddr); $proto = getprotobyname('tcp'); socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "Can't set up connection to VCL: $!"; connect(SOCK, $paddr) || die "Can't connect to VCL: $!"; # Autoflush everything. $old=select(SOCK); $|=1; select($old); # Print the request print SOCK <<EOF; POST /artist-admin/upload.cgi HTTP/1.0 Referer: User-Agent: RedWolf VCL Art Admin v0.2 (send2vcl) Host: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png +, */* Accept-Language: en Accept-Charset: iso-8859-1,*,utf-8 Authorization: Basic nothing-really-here-really Content-type: multipart/form-data; boundary=---VCLADMIN EOF open(OUT,">/tmp/vcl.$$") || die "/tmp/vcl.$$: $!"; print OUT "-----VCLADMIN\r\n"; print OUT "Content-Disposition: form-data; name=\"uploaddir\"\r\n\r\n" +; print OUT "$dir\r\n"; print OUT "-----VCLADMIN\r\n"; print OUT "Content-Disposition: form-data; name=\"/Artists/Kelly-Price +\"; filename=\"$fi\"\r\n"; print OUT "Content-type: $type\r\n\r\n"; open(IN,"<$f") || die "Can't open $f: $!"; while(<IN>) { print OUT; } print OUT "\r\n-----VCLADMIN--\r\n"; close(OUT); $len=-s "/tmp/vcl.$$"; print SOCK "Content-Length: $len\r\n\r\n"; open(IN,"</tmp/vcl.$$") || die "Painfully!!! $!"; while(<IN>) { print SOCK; } while(<SOCK>) { print; }

In reply to Velar Central File Submitter by strredwolf

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (4)
    As of 2018-05-26 14:30 GMT
    Find Nodes?
      Voting Booth?