Skip to content

Instantly share code, notes, and snippets.

View andyhuzhill's full-sized avatar
🏠
Working from home

Zhenyu Hu andyhuzhill

🏠
Working from home
View GitHub Profile
@hugozhu
hugozhu / douban.php
Created January 3, 2013 05:10
Raspberry Pi上听豆瓣电台的简易方法:sudo apt-get install mpg123 php5-cli,然后执行本程序即可
#!/usr/bin/env php
<?php
function fetch_page($url, $timeout = 5) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);