Skip to content

Instantly share code, notes, and snippets.

@nahakiole
Last active August 29, 2015 14:18
Show Gist options
  • Save nahakiole/67e661a5d75139593b70 to your computer and use it in GitHub Desktop.
Save nahakiole/67e661a5d75139593b70 to your computer and use it in GitHub Desktop.
Create map of http://lotrproject.com/map as a big picture.
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST , false);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
for ($x = 0; $x <= 11; $x++){
for ($y = 0; $y < 11; $y++){
curl_setopt($ch, CURLOPT_URL,'http://lotrproject.com/map/meincludes/tiles/4/'.$x.'/'.$y.'.jpg');
$saveto= 'tile_r'.str_pad(abs($y-10), 2, '0', STR_PAD_LEFT).'_c'.str_pad($x, 2, '0', STR_PAD_LEFT).'.jpg';
var_dump( $saveto);
$raw = curl_exec($ch);
if(file_exists($saveto)){
unlink($saveto);
}
$fp = fopen($saveto, 'x');
fwrite($fp, $raw);
fclose($fp);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment