dongxia026531 2015-11-20 10:16
浏览 408

通过lh3.googleusercontent.com获取直接链接表单重定向链接

How to get url redirect in php

Like you fill it in browser

---https://lh3.googleusercontent.com/1I1FrmTThL6inx681XYApSPq5wrixuVzVvRZPiTHsiA=m22---

become

---//r2---sn-i3b7kn7z.googlevideo.com/videoplayback?id=d8c2e2b465cd28a7&itag=22&source=picasa&begin=0&requiressl=yes&mm=30&mn=sn-i3b7kn7z&ms=nxu&mv=m&nh=IgpwcjAxLmhrZzA4KgkxMjcuMC4wLjE&pl=19&mime=video/mp4&lmt=1438597716404239&mt=1448012195&ip=14.162.103.141&ipbits=8&expire=1448041095&sparams=ip,ipbits,expire,id,itag,source,requiressl,mm,mn,ms,mv,nh,pl,mime,lmt&signature=06D26A3C592DD99A4E7E2BC04747E3022AD30071.09139E1F57105925D9BF39F6BE152E7068350D40&key=ck2---

I tried with a code

<?php

      $ch = curl_init("//lh3.googleusercontent.com/gNqSDOMdfLcZDOv1j7TGfEQSzXrk0ngBSloMd6JSjGQ=m22");
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
      curl_setopt($ch, CURLOPT_HEADER, true); 
      curl_setopt($ch, CURLOPT_NOBODY, true); 
      $response = curl_exec($ch); 
      $resolved = curl_getinfo($ch); 
      echo $resolved['url']; 
  ?>

://r8---sn-ab5l6nel.googlevideo.com/videoplayback?id=f091f46ecaa177ea&itag=22&source=picasa&begin=0&requiressl=yes&mm=30&mn=sn-ab5l6nel&ms=nxu&mv=u&pl=48&mime=video/mp4&lmt=1438598135161434&mt=1448012329&ip=2604:a880:800:a1::75:6001&ipbits=48&expire=1448042024&sparams=ip,ipbits,expire,id,itag,source,requiressl,mm,mn,ms,mv,pl,mime,lmt&signature=9259AF5059FA660980BB65F95637C73690207B67.3F352385B6D53E5FF4938A859338554D90173F7A&key=ck2

I was delighted, but it does not run.

Thank you very much!

  • 写回答

1条回答 默认 最新

  • dtuqxb3884 2017-01-22 13:27
    关注

    I know what you are trying to do and the video does not play, because the response you receive will not contain the Access-Control-Origin-Policy header. Which means browser cannot access the response receive without that header. It's for security purposes. Any how, to solve this, you have to replace the https://r2---sn-i3b7kn7z part with https://redirector.

    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集