Hunbook
Hunbook
Hunter Wu
Buy on Leanpub

cURL & wget

cURL

  • -i 顯示 header
curl -i https://api.github.com/users/wmh
  • -u 帶入帳號/密碼
curl -i -u username https://api.github.com/users/wmh
curl -i -u username:password https://api.github.com/users/wmh

wget

  • 直接使用 header 提供的檔名存檔
wget --content-disposition

API Samples

mandrillapp.com

 1 try {
 2   require_once 'src/Mandrill.php';
 3   $mandrill = new Mandrill('API-KEY');
 4   $message = array(
 5     'html' => file_get_contents('email.html'),
 6     'subject' => '十週年!',
 7     'from_email' => 'support@example.com',
 8     'from_name' => '站長',
 9     'to' => array(
10       array(
11         'email' => 'receiver@example.com',
12       ),
13     )
14   );
15   $async = false;
16   $ip_pool = 'Main Pool';
17   $result = $mandrill->messages->send($message, $async, $ip_pool);
18 
19 } catch(Mandrill_Error $e) {
20   echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage(\
21 );
22   throw $e;
23 }