Created
February 10, 2013 13:04
-
-
Save Darkflib/4749530 to your computer and use it in GitHub Desktop.
fontsquirrel grabber, using their open api. Please don't abuse their great service.
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 characters
| <?php | |
| $data=file_get_contents('http://www.fontsquirrel.com/api/fontlist/all'); | |
| $json=json_decode($data,true); | |
| function grabfont($fontname) { | |
| $url='http://www.fontsquirrel.com/fontfacekit/'.$fontname; | |
| $fp=fopen('fonts/'.$fontname.'.zip','w'); | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_FILE, $fp); | |
| curl_setopt($ch, CURLOPT_HEADER, 0); | |
| curl_exec($ch); | |
| curl_close($ch); | |
| fclose($fp); | |
| } | |
| //print_r($json); | |
| foreach($json as $font) { | |
| echo $font['foundry_name']."\n"; | |
| grabfont($font['foundry_urlname']); | |
| sleep(1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment