Mùng 1 ốm nằm nhà code cái này cho anh +Hưng Nguyễn Việt.
Tiếp từ cái này: http://www.familug.org/2013/02/tu-viet-1-chuong-trinh-download-nhac-tu.html
Code php chạy trong môi trường CLI.
Bài viết thực hiện trên:
lamdt@laptop-home: /var/www () $ uname -ir && lsb_release -d
3.5.0-17-generic i686
Description: Ubuntu 12.10
Cấu trúc Directory:
lamdt@laptop-home: /var/www () $ ls -la nct/
total 12
drwxr-xr-x 2 lamdt lamdt 4096 Feb 10 19:25 .
drwxr-xr-x 3 lamdt root 4096 Feb 10 18:21 ..
-rw-rw-r-- 1 lamdt lamdt 1186 Feb 10 19:28 url.php
Phiên bản
lamdt@laptop-home: /var/www () $ php -v
PHP 5.4.6-1ubuntu1.1 (cli) (built: Nov 15 2012 01:23:47)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Configuration
lamdt@laptop-home: /var/www () $ php --ini
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File: /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed: /etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/20-curl.ini,
/etc/php5/cli/conf.d/20-memcached.ini,
/etc/php5/cli/conf.d/20-mysql.ini,
/etc/php5/cli/conf.d/20-mysqli.ini,
/etc/php5/cli/conf.d/20-pdo_mysql.ini
Code:
Các tham số:
- -h :Help
- -u :Link NCT
- -d :Enable download
Get link:
lamdt@laptop-home: /var/www/nct () $ php5 url.php -u http://www.nhaccuatui.com/bai-hat/our-same-word-orchestra-ver-yiruma.U6_h_PbuBH.html
Download Link:
http://tmp.mp3.stream.nixcdn.com/6e7efbcd60c5cce54c8772ac6bf034df/51179289/NhacCuaTui059/OurSameWordOrchestraver-Yiruma_9g7m.mp3
=====================================
Download:
lamdt@laptop-home: /var/www/nct () $ php5 url.php -u http://www.nhaccuatui.com/bai-hat/our-same-word-orchestra-ver-yiruma.U6_h_PbuBH.html -d
Download Link:
http://tmp.mp3.stream.nixcdn.com/6e7efbcd60c5cce54c8772ac6bf034df/51179289/NhacCuaTui059/OurSameWordOrchestraver-Yiruma_9g7m.mp3
=====================================
Download start..................--2013-02-10 19:52:43-- http://tmp.mp3.stream.nixcdn.com/6e7efbcd60c5cce54c8772ac6bf034df/51179289/NhacCuaTui059/OurSameWordOrchestraver-Yiruma_9g7m.mp3
Resolving tmp.mp3.stream.nixcdn.com (tmp.mp3.stream.nixcdn.com)... 123.30.134.105, 123.30.134.104
Connecting to tmp.mp3.stream.nixcdn.com (tmp.mp3.stream.nixcdn.com)|123.30.134.105|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2842915 (2.7M) [audio/mpeg]
Saving to: `OurSameWordOrchestraver-Yiruma_9g7m.mp3'
100%[==================================================================================================>] 2,842,915 116K/s in 18s
2013-02-10 19:53:02 (150 KB/s) - `OurSameWordOrchestraver-Yiruma_9g7m.mp3' saved [2842915/2842915]
lamdt@laptop-home: /var/www/nct () $ ll
total 2792
130312 drwxr-xr-x 2 lamdt lamdt 4096 Feb 10 19:52 .
138490 drwxr-xr-x 3 lamdt root 4096 Feb 10 18:21 ..
130313 -rw-rw-r-- 1 lamdt lamdt 2842915 Jul 5 2011 OurSameWordOrchestraver-Yiruma_9g7m.mp3
131647 -rw-rw-r-- 1 lamdt lamdt 1315 Feb 10 19:48 url.php
No comments:
Post a Comment