PhpMyAdmin
설치방법





php프로젝트를 하려면 데이터베이스 관리툴이 필요하다.

요즘엔 좋은 프로그램이 많지만

옛날에 쓰던 PhpMyAdmin이 생각나서 설치해보도록 한다.

다른 툴을 몇개 써봤는데 가장 익숙하고 사용하기 편한거 같다.


이것도 좀 예전데 개인서버에 설치할 때 적어둔거라서

지금이랑 좀 다를 수도 있는데, 여튼 설치 자체는 어렵지 않으니 넘어간다.



1. 설치하기
 -> sudo apt-get install phpmyadmin
 -> 중간에 선택하는 부분 = apache2를 설치 했으므로 아파치를 선택한다
 ->yes 선택
 ->비번설정

2. 설정하기
-> sudo vi /etc/apache2/apache2.conf

맨 마직막에 아래 구문 추가
# Enable PhpMyAdmin
Include /etc/phpmyadmin/apache.conf

Apache 재시작
-> sudo /etc/init.d/apache2 restart

PhpMyAdmin 접속
http://localhost/phpmyadmin

3. 삭제하기
-> sudo apt-get remove phpmyadmin


**참고 사이트 -http://batsu05.egloos.com/2613652  **

'IT' 카테고리의 다른 글

[jQuery]select박스  (2) 2017.04.26
[jQuery]트리구조 플러그인 - fancytree  (0) 2017.04.20
[PHP]PhpMyAdmin 설치  (0) 2017.04.12
[리눅스]가상서버 만들기 2탄  (0) 2017.04.09
[Ubuntu]가상서버 만들기 1탄  (0) 2017.04.04
[Trello]공동작업 툴  (0) 2017.03.23

Ubuntu 가상서버 만들기

2탄 - 우분투 설치 및 설정

 







1탄에 이어서 가상서버만들기 2탄을 작성한다.

2탄에서는 Apache, MySQL, PHP 설치와 setting을 다루도록 한다.


1탄에서와 마찬가지로 내가 찾아가면서 한거라 부족할 수도 있다.


1. Apache, MySQL, PHP설치
https://youtu.be/pBgOaHrZf-o


내가 보고 따라한 동영상이다.

여기서 하는데로 순서대로 잘 따라하면 쉽게 설치 할 수 있다.

아래는 그내용을 정리한것일 뿐.



- 터미널을 실행 후 명령어를 입력한다.
  -> sudo apt-get update; (패키지 업데이트)

리눅스가 알아서 서버에 접속해서 apache2를 다운로드 받고 컴퓨터에 설치할 것이다. 
  -> sudo apt-get install apache2; (아파치 설치)

- mysql 인증 모듈을 설치한다.
  -> sudo apt-get install libapache2-mod-auth-mysql


- mysql을 설치한다. 아래 명령을 입력한다.
  -> sudo apt-get install mysql-server mysql-client

- mysql을 관리할 사용자(root)의 비번을 지정한다.

- php 설치
  ->  sudo apt-get install php5-common php5 libapache2-mod-php5

- php와 mysql을 연동하기 위한 모듈을 설치한다.
  -> sudo apt-get install php5-mysql

- apache 재시작한다.
 -> sudo /etc/init.d/apache2 restart

- mysql 재시작한다.
  -> sudo /etc/init.d/mysql restart

- 설치가 잘 되었는지 테스트 해본다.
  -> sudo gedit /var/www/phpinfo.php
 -> <?php phpinfo(); ?> 입력 후 저장.
  -> 파이어폭스실행 후 http://localhost/phpinfo.php입력한다.
  -> php버전 및 정보 페이지가 뜨면 성공!
  -> 터미널에 mysql -uroot -p 입력 후 서버버전 및 설명이 나오면 성공!

** 참고 강의 https://opentutorials.org/course/488/2602 **



--추가 mysql 삭제시--
암호를 잃어버렸을 경우 완전 제거를 해야 하며, 이를 위해서는 아래 명령을 수행한다.
$ sudo apt-get remove --purge mysql*
$ sudo apt-get autoremove
$ sudo apt-get autoclean

위가 안되면 5.5기준 겁나 깨끗하게 삭제하는 방법이다.
$ apt-get autoremove mysql-server mysql-common
$ dpkg -P --force depends mysql-server mysql-server-5.5 mysql-common mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5
$ apt-get autoremove
$ apt-get clean
$ dpkg -l | grep -i mysql
$ rm -rvf /var/lib/mysql

 

'IT' 카테고리의 다른 글

[jQuery]트리구조 플러그인 - fancytree  (0) 2017.04.20
[PHP]PhpMyAdmin 설치  (0) 2017.04.12
[리눅스]가상서버 만들기 2탄  (0) 2017.04.09
[Ubuntu]가상서버 만들기 1탄  (0) 2017.04.04
[Trello]공동작업 툴  (0) 2017.03.23
[jQuery].dotdotdot 말줄임  (2) 2017.03.19

유튜브 정보 추출

file_get_contents




유튜브 동영상의 url을 가지고 온갖 정보를 추출해보자.

php 함수로 간단하게 파악할 수 있다.


file_get_contents(); 

: 웹상의 파일을 읽어오는 함수.




익숙한 유튜브 화면.

여기서 필요한건 단한가지.

동영상의 ID.



빨간 네모 안에 있는 문자열이 동영상의 ID.

복사를 잘 해놓아야된다.


file_get_contents에 들어갈 인자값인 url은 아래의 형태여야 한다.

http://youtube.com/get_video_info?video_id=ID

 유튜브 동영상을 다운로드 할 때 쓰이기도 하는 url형식이다.


아까 복사해놓은 ID를 소스에 넣는다.

$id = 't41DYdwur2U';


$content = file_get_contents("http://youtube.com/get_video_info?video_id=".$id);

parse_str($content, $data);

echo "<pre>"; print_r($data); echo "</pre>";

$data변수를 출력해보면


Array
(
    [loeid] => 9406012,9407745,9410706,9422596,9428398,9431012,9433221,9434289,9441147,9444898,9446054,9450707,9451827,9454406,9454899,9456628,9457115,9457167,9458240,9458703,9459457,9460349,9461429,9461560,9464286,9465400,9465919,9466110,9466155,9466594,9466831,9467027,9467652
    [enablecsi] => 1
    [tag_for_child_directed] => False
    [watermark] => ,http://s.ytimg.com/yts/img/watermark/youtube_watermark-vflHX6b6E.png,http://s.ytimg.com/yts/img/watermark/youtube_hd_watermark-vflAzLcD6.png
    [no_get_video_log] => 1
    [timestamp] => 1489736032
    [show_content_thumbnail] => True
    [adaptive_fmts] => size=1280x720&fps=30&s=C2C29E7E4E869884BE5A98FBF5A232FAB7F47150D7.C443A9FA86B593AB8D42C6C52CE519C5694E689EE&clen=30828682&bitrate=1143856&projection_type=1&index=711-1306&lmt=1428048379495223&itag=136&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fmp4%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D30828682%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1428048379495223%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D136%26source%3Dyoutube%26dur%3D240.666%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&type=video%2Fmp4%3B+codecs%3D%22avc1.4d401f%22&quality_label=720p&init=0-710,size=1280x720&fps=30&s=5C5CF0CDD0271AB484FB2A4A374B9F98ACCAD445A3.FCD664DFF7C12356612C468CEAA1EA74EFE0DAB0B&clen=19194330&bitrate=957073&projection_type=1&index=243-1003&lmt=1449617647725180&itag=247&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fwebm%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D19194330%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1449617647725180%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D247%26source%3Dyoutube%26dur%3D240.633%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&type=video%2Fwebm%3B+codecs%3D%22vp9%22&quality_label=720p&init=0-242,size=854x480&fps=30&s=F3F31CC831BBD19C84A5D2E23077D73F50C88B7D65.C6DACB5041A43FB735EAD145BBCDBEB2EDA7C6371&clen=15410061&bitrate=574516&projection_type=1&index=710-1305&lmt=1428048280791746&itag=135&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fmp4%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D15410061%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1428048280791746%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D135%26source%3Dyoutube%26dur%3D240.666%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&type=video%2Fmp4%3B+codecs%3D%22avc1.4d401f%22&quality_label=480p&init=0-709,size=854x480&fps=30&s=C9C980FBECDDC048E1935BE0748DBDAB7EE00E79A5.C06E023A25BF805D268B22304A99A7CB4DFA918A6&clen=9673948&bitrate=503117&projection_type=1&index=243-998&lmt=1449617647560894&itag=244&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fwebm%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D9673948%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1449617647560894%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D244%26source%3Dyoutube%26dur%3D240.633%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&type=video%2Fwebm%3B+codecs%3D%22vp9%22&quality_label=480p&init=0-242,size=640x360&fps=30&s=D3D327B4478C91714F6E75002367A19A72CDCE3544.77179B42943EC6BF30928241BBAD14BB10B6EC268&clen=7306125&bitrate=272840&projection_type=1&index=710-1305&lmt=1428048255977015&itag=134&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fmp4%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D7306125%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1428048255977015%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D134%26source%3Dyoutube%26dur%3D240.666%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&type=video%2Fmp4%3B+codecs%3D%22avc1.4d401e%22&quality_label=360p&init=0-709,size=640x360&fps=30&s=CDCDB711B0A719768DE7EC895B273FAC9341CA0555.2E302176FC42B74FF54CEEDD556C47B93B207580A&clen=6194265&bitrate=332057&projection_type=1&index=243-998&lmt=1449617647493648&itag=243&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fwebm%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D6194265%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1449617647493648%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D243%26source%3Dyoutube%26dur%3D240.633%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&type=video%2Fwebm%3B+codecs%3D%22vp9%22&quality_label=360p&init=0-242,size=426x240&fps=30&s=73737BCF5091144C4DE86A0D45815115A0ADD87C80.2440D55F443A05DC104B0976A1A740A0960913999&clen=7352427&bitrate=247900&projection_type=1&index=675-1270&lmt=1428048241487584&itag=133&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fmp4%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D7352427%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1428048241487584%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D133%26source%3Dyoutube%26dur%3D240.666%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&type=video%2Fmp4%3B+codecs%3D%22avc1.4d4015%22&quality_label=240p&init=0-674,size=426x240&fps=30&s=2323FB89485F3F027FB55B4D39DDD9CB4E4B845521.1B0BF58B1E31DC364B92202E29BD20E9EFD614C6D&clen=3708701&bitrate=202478&projection_type=1&index=242-997&lmt=1449617647511478&itag=242&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fwebm%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D3708701%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1449617647511478%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D242%26source%3Dyoutube%26dur%3D240.633%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&type=video%2Fwebm%3B+codecs%3D%22vp9%22&quality_label=240p&init=0-241,size=256x144&fps=15&s=E9E93C1E5F07AADD598EB152CB6A6EBB3FD4D46944.7D61A83C1AF336D1165FF3D7DB510F5E4AADDB1DD&clen=3286659&bitrate=112530&projection_type=1&index=672-1267&lmt=1428048223061456&itag=160&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fmp4%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D3286659%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1428048223061456%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D160%26source%3Dyoutube%26dur%3D240.633%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&type=video%2Fmp4%3B+codecs%3D%22avc1.4d400c%22&quality_label=144p&init=0-671,size=256x144&fps=15&s=CDCDD935709F0EC349BE168773C567A97F42AB6E4D.874CF04105DEF7FA10B0338149751742FD8025F07&clen=2853152&bitrate=109778&projection_type=1&index=242-996&lmt=1449617647505738&itag=278&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fwebm%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D2853152%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1449617647505738%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D278%26source%3Dyoutube%26dur%3D240.599%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&type=video%2Fwebm%3B+codecs%3D%22vp9%22&quality_label=144p&init=0-241,lmt=1428048198855772&type=audio%2Fmp4%3B+codecs%3D%22mp4a.40.2%22&itag=140&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Daudio%252Fmp4%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D3865231%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1428048198855772%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D140%26source%3Dyoutube%26dur%3D240.721%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&s=353588546E13B22283C93A1D5FB3B95E90EE4249A1.69CF01DDB2CEAE563787A1FF01F4A9D2A76BBBAB0&projection_type=1&bitrate=129444&clen=3865231&index=592-923&init=0-591,lmt=1449617315818312&type=audio%2Fwebm%3B+codecs%3D%22vorbis%22&itag=171&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Daudio%252Fwebm%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D3663750%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1449617315818312%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D171%26source%3Dyoutube%26dur%3D240.668%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&s=BDBDB3DC41D981AC24480A1A8B0DC1BDBF71DAD419.6582A4FABFE69D42A21911D2F427B2A93BC098A05&projection_type=1&bitrate=126659&clen=3663750&index=4452-4873&init=0-4451,lmt=1449617315565780&type=audio%2Fwebm%3B+codecs%3D%22opus%22&itag=249&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Daudio%252Fwebm%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D1609616%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1449617315565780%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D249%26source%3Dyoutube%26dur%3D240.681%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&s=B2B23003738856355DBF70967EDAC5828C98C65D40.BA8E088C43697205AB0FAC6A8E2F59871E5221D21&projection_type=1&bitrate=58824&clen=1609616&index=272-692&init=0-271,lmt=1449617316470783&type=audio%2Fwebm%3B+codecs%3D%22opus%22&itag=250&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Daudio%252Fwebm%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D2248952%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1449617316470783%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D250%26source%3Dyoutube%26dur%3D240.681%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&s=2E2E6B36B12DCF5B52DEB112A1ECD241DD7412547D.5EA34763C3C5E71F34D302A2A26AF09410F307E3D&projection_type=1&bitrate=84334&clen=2248952&index=272-693&init=0-271,lmt=1449617316233888&type=audio%2Fwebm%3B+codecs%3D%22opus%22&itag=251&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Daudio%252Fwebm%26gir%3Dyes%26pl%3D18%26ipbits%3D0%26ip%3D211.192.25.206%26clen%3D4315054%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26expire%3D1489757632%26lmt%3D1449617316233888%26mm%3D31%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D251%26source%3Dyoutube%26dur%3D240.681%26mv%3Dm%26key%3Dyt6%26upn%3DEopQtLldVCw%26sparams%3Dclen%252Cdur%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26mt%3D1489735942&s=12128406BA91DD5BF7985AFC56BDA2F0F784995561.692B0233C89E4CC7E52423C60A41042DF703A7B31&projection_type=1&bitrate=154430&clen=4315054&index=272-693&init=0-271
    [author] => onoff23
    [iurl] => http://i.ytimg.com/vi/t41DYdwur2U/hqdefault.jpg
    [view_count] => 2567833
    [iurlsd] => http://i.ytimg.com/vi/t41DYdwur2U/sddefault.jpg
    [core_dbp] => ChZqZkRyRHlCSzMwSVotQVJuM0VUcXdREAEgASgA
    [relative_loudness] => 2.18099975586
    [c] => WEB
    [muted] => 0
    [enabled_engage_types] => 1,3,4,5,6,17
    [token] => vjVQa1PpcFNFEWdVDlfKFfhk-rABZs-pcrPhFiyR0WY=
    [fade_out_start_milliseconds] => 0
    [shortform] => True
    [url_encoded_fmt_stream_map] => quality=hd720&s=DBDBBA547CC4206ADE852C7196C3E002AAC12F9204.2339390799E107EE2982426536CA4534C8AD113D0&itag=22&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fmp4%26pl%3D18%26expire%3D1489757632%26mm%3D31%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D22%26mt%3D1489735942%26mv%3Dm%26upn%3D3Orh-gxGHiA%26sparams%3Ddur%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Csource%252Cupn%252Cexpire%26ipbits%3D0%26ip%3D211.192.25.206%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26beids%3D%255B9466594%255D%26lmt%3D1470898182022531%26ratebypass%3Dyes%26source%3Dyoutube%26dur%3D240.721%26key%3Dyt6&type=video%2Fmp4%3B+codecs%3D%22avc1.64001F%2C+mp4a.40.2%22&fallback_host=redirector.googlevideo.com,quality=medium&s=CECEDCEAD12B679EE26E53A07A4F19B16614263480.401D2B266758AE10E0982CBC5DE30BA5C954E4D46&itag=43&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fwebm%26pl%3D18%26expire%3D1489757632%26mm%3D31%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D43%26mt%3D1489735942%26mv%3Dm%26upn%3D3Orh-gxGHiA%26sparams%3Ddur%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Csource%252Cupn%252Cexpire%26ipbits%3D0%26ip%3D211.192.25.206%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26beids%3D%255B9466594%255D%26lmt%3D1384513205027512%26ratebypass%3Dyes%26source%3Dyoutube%26dur%3D0.000%26key%3Dyt6&type=video%2Fwebm%3B+codecs%3D%22vp8.0%2C+vorbis%22&fallback_host=redirector.googlevideo.com,quality=medium&s=7C7C7B38DD91FA14E6C5D27D438FF031827FC88F38.A83DCDE5DDA265EC6653EE5B193C9155F7E803D89&itag=18&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Fmime%3Dvideo%252Fmp4%26pl%3D18%26expire%3D1489757632%26mm%3D31%26mn%3Dsn-3u-bh2k%26initcwndbps%3D4272500%26ms%3Dau%26itag%3D18%26mt%3D1489735942%26mv%3Dm%26upn%3D3Orh-gxGHiA%26sparams%3Ddur%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Csource%252Cupn%252Cexpire%26ipbits%3D0%26ip%3D211.192.25.206%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26beids%3D%255B9466594%255D%26lmt%3D1428048275570169%26ratebypass%3Dyes%26source%3Dyoutube%26dur%3D240.721%26key%3Dyt6&type=video%2Fmp4%3B+codecs%3D%22avc1.42001E%2C+mp4a.40.2%22&fallback_host=redirector.googlevideo.com,quality=small&s=1E1E4020EABFCC02616AD5EE32CAA7B400E56F3463.4869239BB7F2B39227955D4B112BA5D76698ACC8F&itag=36&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Finitcwndbps%3D4272500%26mt%3D1489735942%26mime%3Dvideo%252F3gpp%26pl%3D18%26mm%3D31%26ipbits%3D0%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26lmt%3D1387706558214156%26ms%3Dau%26itag%3D36%26source%3Dyoutube%26dur%3D240.883%26mv%3Dm%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26ip%3D211.192.25.206%26upn%3D3Orh-gxGHiA%26key%3Dyt6%26sparams%3Ddur%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26expire%3D1489757632&type=video%2F3gpp%3B+codecs%3D%22mp4v.20.3%2C+mp4a.40.2%22&fallback_host=redirector.googlevideo.com,quality=small&s=2828C06D2F267211612B864FC350F1DCD2340DA7B8.0BF6BD8DB9C201F03E3050CD83CD0AAD28BE5EFE9&itag=17&url=http%3A%2F%2Fr4---sn-3u-bh2k.googlevideo.com%2Fvideoplayback%3Finitcwndbps%3D4272500%26mt%3D1489735942%26mime%3Dvideo%252F3gpp%26pl%3D18%26mm%3D31%26ipbits%3D0%26beids%3D%255B9466594%255D%26mn%3Dsn-3u-bh2k%26lmt%3D1387706481670652%26ms%3Dau%26itag%3D17%26source%3Dyoutube%26dur%3D241.069%26mv%3Dm%26id%3Do-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf%26ip%3D211.192.25.206%26upn%3D3Orh-gxGHiA%26key%3Dyt6%26sparams%3Ddur%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Csource%252Cupn%252Cexpire%26expire%3D1489757632&type=video%2F3gpp%3B+codecs%3D%22mp4v.20.3%2C+mp4a.40.2%22&fallback_host=redirector.googlevideo.com
    [ad_flags] => 1
    [fmt_list] => 22/1280x720/9/0/115,43/640x360/99/0/0,18/640x360/9/0/115,36/426x240/99/1/0,17/256x144/99/1/0,13/256x144/99/1/0
    [fade_in_start_milliseconds] => -3000
    [loudness] => -18.8190002441
    [ypc_ad_indicator] => 4
    [iurlhq720] => http://i.ytimg.com/vi/t41DYdwur2U/hq720.jpg
    [is_listed] => 1
    [csi_page_type] => embed
    [allow_below_the_player_companion] => True
    [short_view_count_text] => 조회수 256만회
    [title] => 히사이시 조 - One Summer's Day (센과 치히로의 행방불명ost) Spiriting Away
    [sffb] => True
    [status] => ok
    [idpj] => -5
    [ad_device] => 1
    [eventid] => YJHLWODNIdCn4ALbmau4Cw
    [vmap] => YT:AdSense

[keywords] => [plid] => AAVK6DMIcPbKxCyV [ldpj] => -31 [vm] => CAMQARgC [afv] => True [thumbnail_url] => http://i.ytimg.com/vi/t41DYdwur2U/default.jpg [tmi] => 1 [ucid] => UCtgheJqpGBxRT_WIolBwd3Q [ad_slots] => 0 [fade_in_duration_milliseconds] => 1000 [videostats_playback_base_url] => https://s.youtube.com [of] => jfDrDyBK30IZ-ARn3ETqwQ [video_verticals] => [893, 317] [fexp] => 9406012,9407745,9410706,9422596,9428398,9431012,9433221,9434046,9434289,9441147,9444898,9446054,9446364,9449034,9449243,9450059,9450707,9453898,9454406,9456640,9457141,9457167,9458230,9458577,9458703,9459457,9460160,9461429,9461560,9463496,9463594,9463965,9464097,9464286,9465026,9465400,9465533,9465919,9466110,9466155,9466308,9466594,9466793,9466831,9467027,9467652 [use_cipher_signature] => True [dashmpd] => http://manifest.googlevideo.com/api/manifest/dash/mt/1489735942/as/fmp4_audio_clear%2Cfmp4_sd_hd_clear/pl/18/s/A7A7833084348FEFF1843FD38DD249ACABE9984168.68AF6E5EAE450D309861575BF1FB0127D874C2A49/mm/31/ipbits/0/beids/%5B9466594%5D/hfr/1/initcwndbps/4272500/ms/au/itag/0/expire/1489757632/playback_host/r4---sn-3u-bh2k.googlevideo.com/mv/m/id/o-AL1Ifsl-aDoujRCkiicrM5SOXi8Xnnu0oCep6Lc35XSf/ip/211.192.25.206/mn/sn-3u-bh2k/upn/SrCHPotGAYw/key/yt6/sparams/as%2Chfr%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cplayback_host%2Csource%2Cexpire/source/youtube [avg_rating] => 4.94246339363 [allow_embed] => 1 [ad_logging_flag] => 1 [iurlhq] => http://i.ytimg.com/vi/t41DYdwur2U/hqdefault.jpg [fade_out_duration_milliseconds] => 1000 [video_id] => t41DYdwur2U [storyboard_spec] => http://i.ytimg.com/sb/t41DYdwur2U/storyboard3_L$L/$N.jpg|48#27#100#10#10#0#default#rKXsmR3cNbwfkrVS8wCc9HdNJ2M|80#45#122#10#10#2000#M$M#y5ifhToeak6fsG71Y4mcmzFeITU|160#90#122#5#5#2000#M$M#YEgOG-6yd4x7-8ATno0XE3JN6xQ [probe_url] => http://r6---sn-a5m7ln7s.googlevideo.com/videogoodput?id=o-AO38mMTMhmyQRu--fnpAoG7w6Z1IXhTJ1f41v6MkRsRV&source=goodput&range=0-4999&expire=1489739632&ip=211.192.25.206&ms=pm&mm=35&pl=24&nh=IgpwZjAxLmxheDE2Kg0yMTYuMTU2LjY0Ljc3&sparams=id,source,range,expire,ip,ms,mm,pl,nh&signature=5E32B52DFD98C05B4BCBA7E17DEE62490457ABF9.250023FA7387B2E719055A9B6ED71638442D6B00&key=cms1 [allow_html5_ads] => 1 [cid] => 319133 [dbp] => Ch4KFmpmRHJEeUJLMzBJWi1BUm4zRVRxd1EQASABKAAYAg [hl] => ko_KR [has_cc] => False [mpvid] => d4UrEe9-3mWeCMUa [iurlmaxres] => http://i.ytimg.com/vi/t41DYdwur2U/maxresdefault.jpg [ptk] => youtube_multi [allow_ratings] => 1 [afv_ad_tag] => http://googleads.g.doubleclick.net/pagead/ads?ad_type=text_image&channel=Vertical_3%2BVertical_316%2BVertical_317%2BVertical_35%2BVertical_893%2Bafv_overlay%2Bafv_ugc%2Bafv_user_alocasha%2Bafv_user_id_tgheJqpGBxRT_WIolBwd3Q%2Binvideo_overlay_480x70_cat10%2Byt_cid_319133%2Byt_mpvid_d4UrEe9-3mWeCMUa%2Byt_no_360%2Byt_no_ap%2Byt_no_cp%2Byt_no_wa%2Bytdevice_1%2Bytdevicever_1.20170316%2Bytel_embedded%2Bytps_default&client=ca-pub-6219811747049371&dbp=ChZqZkRyRHlCSzMwSVotQVJuM0VUcXdREAEgASgA&description_url=http%3A%2F%2Fwww.youtube.com%2Fvideo%2Ft41DYdwur2U&eid=17946202&hl=ko&host=ca-host-pub-1800120140230655&ht_id=439818&loeid=9406012,9407745,9410706,9422596,9428398,9431012,9433221,9434289,9441147,9444898,9446054,9450707,9451827,9454406,9454899,9456628,9457115,9457167,9458240,9458703,9459457,9460349,9461429,9461560,9464286,9465400,9465919,9466110,9466155,9466594,9466831,9467027,9467652&osd=2&sdki=18803DED&url=http%3A%2F%2Fwww.youtube.com%2Fvideo%2Ft41DYdwur2U&v_p=JRW1LUQ%3D&ytdevice=1&ytdevicever=1.20170316&yt_pt=APb3F28TL9WksEl83D1v2gu6LWf3_Yh7bU4oWowK0DzntOtH4AFiO0bajkiTTxY6pBhfr0pkQYQq0Mg-Y13-fherZi-zlEbdUw8wy_gntth5pm9AsUSxriYpARb7foZoXmfkbzPw0OVmCLbs2R7Cws1Bl2U7jFui7xw9XA0grNbtbQbVQwxi7LuFC3CrOwsrR9Tz4g_3YznNvu_B151UF0vvV1Cjks8wVggreeNyqwBZeVjKrtB3tnPzYJrYFaVaetNg3cCzO6mf2AJe3E1q_3xJLQ1WPfJpc_MGNVbVPg [instream_long] => False [midroll_prefetch_size] => 1 [apply_fade_on_midrolls] => True [midroll_freqcap] => 420.0 [excluded_ads] => 46=14_14;59=14_14;61=1_3,2_3;65=15_2,15_2_1,15_2_4,17_2,17_2_1;84=1_1,1_2,1_2_1,1_3,2_2,2_2_1,2_2_4,2_3,15_2,15_2_1,15_2_4,17_2,17_2_1;89=2_2,15_2;94=15_2,15_2_1,15_2_4,17_2,17_2_1 [ad_module] => http://s.ytimg.com/yts/swfbin/player-vflo8bFu-/ad.swf [pltype] => contentugc [iurlmq] => http://i.ytimg.com/vi/t41DYdwur2U/mqdefault.jpg [cver] => 1.20170316 [cl] => 150349338 [allowed_ads] => [0, 1, 2, 4, 8, 9, 10, 13, 14] [account_playback_token] => QUFFLUhqbmhiaWhNc29JUzVQaUxQSWVBV1JfNnRNUzVGZ3xBQ3Jtc0trS2FlMmc1Rk1IRkluY0lQc1ZXVkhGNVdlTllBN1lJTWV5M0VwaDNrUURqN1U2Nnc5bl9iYTFFTnZhQkVGS21MNHBfaENGSXFDWXh2RUllbzhZUkhCanEtSzFYSlhIWlctdzhNU09wV19XUVJuUjJYbw== [as_launched_in_country] => 1 [cafe_experiment_id] => 17946202 [gut_tag] => /4061/ytunknown/main [length_seconds] => 241 )


엄청난 데이터가 나온다.

이건 동영상마다 다른데 일부러 데이터가 많은 동영상을 선택했다.

여기서 알고 있는 몇몇개의 요소만 설명하겠다.


view_count                        // 조회수


short_view_count_text             // 조회수 요약 텍스트      title                             // 동영상 제목


keywords                          // 키워드

length_seconds                    // 재생시간 (초단위) author                            // 업로더

thumbnail_url                     // 동영상 썸네일 이미지 url

iurlmq                            // 작은 캡처이미지 url

iurlmaxres                        // 가장큰 캡처이미지 url


iurlhq720                                     // 720p 캡처 이미지 url


맞는지 아닌지 모르겠지만 대충 쓸만한건 이정도인듯.



'IT' 카테고리의 다른 글

[Trello]공동작업 툴  (0) 2017.03.23
[jQuery].dotdotdot 말줄임  (2) 2017.03.19
[PHP] 유투브 동영상 정보 추출  (0) 2017.03.02
[PHP]이미지 리사이징 - ImageMagic  (0) 2017.01.16
[유투브]유투브 썸네일 추출하기  (0) 2017.01.16
[구글맵API]구글맵 API사용하기  (0) 2016.12.19




파일용량 계산하기


일하다보면 가끔 필요한데 외워지진 않고 매번 찾아봐야하는 것들 중 하나....


찾기귀찮아서 적어놓음.


나는 php를 사용하기 때문에 filesize()를 사용해서 byte용량을 받아온다.

그리고 ajax로 통신하여 리턴받은 값을 함수에 변수로 던져준다.


아래에 소스는 구글에 찾으면 가장 많이 나오는 소스중에 하나이다.








function byteCalculation(bytes) {
        var bytes = parseInt(bytes);
        var s = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
        var e = Math.floor(Math.log(bytes)/Math.log(1024));
       
        if(e == "-Infinity") return "0 "+s[0]; 
        else 
        return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e];
}





'IT' 카테고리의 다른 글

[유투브]유투브 썸네일 추출하기  (0) 2017.01.16
[구글맵API]구글맵 API사용하기  (0) 2016.12.19
[jQuery]파일용량 계산하기  (0) 2016.12.14
[PHP]배열 키값 재정의  (0) 2016.12.13
[API]차트생성 - Chart.js  (0) 2016.11.25
[OVEN]프로토타이핑 툴 오븐!(beta)  (0) 2016.11.25




배열 인덱스(키값) 재정의


배열을 사용하다보면 가끔 키값이 이빠진것처럼 비어있을 때가 있다.


ex) $array= {'0'=>'a','1'=>'b','3'=>'c'};


이런식으로....


귀찮지만 다시 정의 해줘야 된다.

애초에 이런 배열을 만들지 않도록 하는게 중요하지만...쩝...

간단하게 foreach문으로 해결해본다.







$i = 0;

foreach($array as $key=>$val){

unset($array[$key]);


$new_key = $i;

$array[$new_key] = $val;


$i++;

}







'IT' 카테고리의 다른 글

[유투브]유투브 썸네일 추출하기  (0) 2017.01.16
[구글맵API]구글맵 API사용하기  (0) 2016.12.19
[jQuery]파일용량 계산하기  (0) 2016.12.14
[PHP]배열 키값 재정의  (0) 2016.12.13
[API]차트생성 - Chart.js  (0) 2016.11.25
[OVEN]프로토타이핑 툴 오븐!(beta)  (0) 2016.11.25

+ Recent posts