Skip to content

Instantly share code, notes, and snippets.

@url2png
Created July 28, 2011 15:53

Revisions

  1. url2png created this gist Jul 28, 2011.
    35 changes: 35 additions & 0 deletions receive.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    <?php

    # =============================
    # = DOM2PNG Proof of Concept =
    # =============================



    function url2png($url,$size,$api_key,$shared_secret)
    {
    global $base;
    global $key;
    global $string;

    $url = preg_replace('/^http:\/\//','',$url); # *yawn*

    $url = str_replace('%','%25',$url);
    $url = str_replace(' ','%20',$url);
    $url = str_replace('&','%26',$url);
    $url = str_replace('#','%23',$url);
    $url = str_replace('?','%3F',$url);

    $magical_hash = md5("$shared_secret+$url");

    return "http://api.url2png.com/v3/$api_key/$magical_hash/$size/$url";

    }

    $key = sha1(time());

    $_POST['dom'] = (empty($_POST['dom'])) ? 'foo' : $_POST['dom'];

    @file_put_contents("./tmp/" . $key . ".html", urldecode($_POST['dom']));

    echo url2png("http://url2png.com/dom2png/tmp/$key.html","300x300","DOM2PNG-APIKEY","DOM2PNG-SECRETKEY");