Created
January 10, 2012 21:48
-
-
Save davidvanvickle/1591407 to your computer and use it in GitHub Desktop.
php download a binary
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
$data = 'hello world'; | |
$source_url = 'https://domain.com/chart?chid=' . md5(uniqid(rand(), true)); | |
// params (http_build_query will later urlencode) | |
$qrcode = array( | |
'cht' => 'qr', | |
'chs' => '177x177', | |
'chl' => $data); | |
// send the request | |
$context = stream_context_create( | |
array('http' => array( | |
'method' => 'POST', | |
'content' => http_build_query($qrcode)))); | |
// save the returned bytes | |
file_put_contents($savepath,fopen($source_url, 'r', false, $context)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment