Created
July 28, 2011 15:53
Revisions
-
url2png created this gist
Jul 28, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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");