Obtain audio and video from Apsara stack using php

Source: Internet
Author: User
PHP obtains the HD and UHD music videos of the music platform. Demo address: music.yuur.net none? Php $ urlisset ($ _ GET [url])? Trim ($ _ GET [url]):; v. yinyuetai. comvideo2185713 $ time $ _ SERVER [REQUEST_TIME]; $ contentfile_get_contents ($ url); GET the title preg_match (

PHP obtains the HD and UHD music videos of the music platform. Demo address: http://music.yuur.net none? Php $ url = isset ($ _ GET ['url'])? Trim ($ _ GET ['url']): ''; // response = file_get_contents ($ url); // obtain the title preg_match ('/

PHP obtains the HD and UHD music videos of the music platform.
Demo address: http://music.yuur.net <无>
  /I ', $ content, $ title); // obtain the cover preg_match ('/property = "og: image" content = "([^"] *) ". *?> /', $ Content, $ images); // obtain the IDpreg_match ('/[\ d] +/', $ url, $ song_id) of the MV ); $ title = $ title [1]; $ images = $ images [1]; $ song_id = $ song_id [0]; // parse json $ songurl = "http://www.yinyuetai.com/api/info/get-video-urls? Callback = callback & videoId = ". $ song_id. "& _ = ". $ time; $ data = file_get_contents ($ songurl); if (strpos ($ data, "callback ")! = False) {$ lpos = strpos ($ data, "("); $ rpos = strrpos ($ data, ")"); $ data = substr ($ data, $ lpos + 1, $ rpos-$ lpos-1);} $ json = json_decode ($ data, true); echo $ title."
"; Echo" LD address: ". $ json ['hcvideourl']."
"; Echo" HD address: ". $ json ['hdvideourl']."
"; Echo" UHD address: ". $ json ['videourl']."
"; Echo" "; // Demo: http://music.yuur.net?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.