我想抓取这个内容 http://whostreams.net/embed/gryr4u074z82x使用卷曲。 我一直在尝试设置其他用户代理,并设置其他选项 但我似乎无法获取该页面的内容,因为我经常被重定向或出现“页面移动”错误。 我认为这与查询字符串编码在某个地方有关,但我真的不确定如何解决。
$url = 'http://whostreams.net/embed/gryr4u074z82x';
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_REFERER, 'http://www.fel3arda.com/2018/09/denmark-vs-wales.html');
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('Host: whostreams.net'));
curl_setopt($curl_handle, CURLOPT_URL,$url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36');
$query = curl_exec($curl_handle);
curl_close($curl_handle);
echo ($query) ;
我需要怎么做才能获取我的php代码以显示页面的确切内容
答案 0 :(得分:0)
curl_exec()必须在curl_close()之前;
因为curl_close()终止CURL会话并释放资源。描述符curl_handle也被破坏。
答案 1 :(得分:0)
您发布的代码对我有效,只需在其中添加一个<?php
。
<?php
$url = 'http://whostreams.net/embed/gryr4u074z82x';
$curl_handle=curl_init();
curl_setopt($curl_handle, CURLOPT_REFERER, 'http://www.fel3arda.com/2018/09/denmark-vs-wales.html');
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('Host: whostreams.net'));
curl_setopt($curl_handle, CURLOPT_URL,$url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36');
$query = curl_exec($curl_handle);
curl_close($curl_handle);
echo ($query) ;
我确实得到了
CLICK HERE TO UNMUTE
STREAM IS OFFLINE
Retrying in seconds
页面+用于从wss://ws.peer5.com开始流传输视频的高度混淆的javascript
您说I just can't seem to get the content of that page
-嗯,您得到什么内容?您期望得到什么呢?因为这大致就是我的Google Chrome浏览器和curl所得到的:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<script>if(window==window.top) document.location="/"</script>
<link rel="stylesheet" href="/css/embed.min.css?v=0.1" />
<!-- Tssp-->
<!-- PopAds.net Popunder Code for whostreams.net | 2018-09-09,2437207,0,0 -->
<script type="text/javascript" data-cfasync="false">
/*<![CDATA[/* */
/* Generated 2018-09-09 16:26:49 for "PopAds%20CGAPIL%20A", len 1367 */
(function(){ var p=window;p["\x5f\x70\x6fp"]=[["\u0073i\x74e\u0049\x64",2437207],["\u006d\x69\x6e\u0042i\x64",0],["\x70\x6f\u0070un\x64er\x73Pe\x72\x49\x50",0],["\x64\x65\u006c\u0061y\u0042e\x74\u0077een",0],["\u0064\x65\u0066\u0061u\u006ct",false],["\x64\u0065fau\x6c\x74P\x65\u0072\x44a\u0079",0],["\u0074o\u0070\x6dos\x74\x4cay\x65\x72",!1]];var l=["/\x2fc\u0031\x2ep\x6f\u0070a\u0064s\u002en\x65\u0074\u002f\x70o\x70\u002e\u006a\u0073","/\u002f\x63\u0032.p\x6fpa\x64\u0073.n\x65t/\x70\u006fp\u002ej\x73","//w\x77\x77.\x6b\u0061\u006f\x6ariv\u006d\u0068\x79s\x2ec\u006f\x6d\u002f\u0062p\x2ejs","/\x2fww\x77.\x74djo\x61\x6f\x73\u0069\u0062\x65\x73\u002e\x63om\x2f\x78\u002ejs",""],w=0,x,a=function(){if(""==l[w])return;x=p["\u0064\x6f\u0063\u0075\u006de\u006e\u0074"]["\x63\u0072e\x61\x74\u0065\u0045le\u006d\x65n\x74"]("\x73cr\u0069\x70\x74");x["\x74\x79\x70\u0065"]="te\x78\x74\u002f\u006a\x61v\x61\u0073\u0063\x72\x69p\u0074";x["\x61\x73\u0079\u006ec"]=!0;var s=p["\x64\x6fcu\u006de\x6et"]["g\u0065\u0074Ele\x6d\x65n\x74\x73\x42\u0079\x54\x61\x67\u004ea\x6d\x65"]("\x73\u0063r\u0069\u0070\u0074")[0];x["\x73\x72c"]=l[w];if(w<2){x["\u0063ro\u0073\x73Or\u0069g\x69\u006e"]="\x61\x6eo\u006e\x79mo\x75s";};x["\u006f\u006ee\x72\x72\u006f\u0072"]=function(){w++;a()};s["p\x61\x72\u0065n\u0074\u004e\u006f\x64\u0065"]["\u0069nse\x72\x74\x42\x65\x66ore"](x,s)};a()})();
/*]]>/* */
</script>
</head>
<body>
<div class="jwplayer jw-reset jw-skin-glow" id="player"></div>
<div id="btn-unmute" onclick="WSUnmute()">CLICK HERE TO UNMUTE</div>
<div class="tb stream-offline" >
<div class="tb-col">
<a href="/" target="_blank"><img src="/imgs/logo.png" /></a>
<h2>STREAM IS OFFLINE</h2>
<p>Retrying in <span class="counter"></span> seconds</p>
</div>
</div>
<script src="/js/jquery.min.js"></script>
<script>var WSreloadCounter,WSnTries=0,videoStarted = false, startMuted = startMuted();function errorPlaying(){$(".stream-offline .counter").text(10);$(".stream-offline").css("display","table");WSreloadCounter=setInterval(function(){var a=$(".stream-offline .counter").text();if(a>1){a--;$(".stream-offline .counter").text(a)}else{ clearInterval(WSreloadCounter);WSnTries++;if(WSnTries<10){WSreloadStream();}else{ window.location.reload() } }},1000)}function startMuted(){var d=/constructor/i.test(window.HTMLElement)||(function(a){return a.toString()==="[object SafariRemoteNotification]"})(!window.safari||(typeof safari!=="undefined"&&safari.pushNotification));if(d){return true}var c=!!window.chrome&&!!window.chrome.webstore;if(c&&getChromeVersion()>=66){return true}return false}function getChromeVersion(){var a=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);return a?parseInt(a[2],10):false};</script>
<script src="//api.peer5.com/peer5.js?id=5yaksk6z3h8drz14s022"></script><script src="//api.peer5.com/peer5.clappr.plugin.js"></script>
<script src="/players/clappr/clappr.min.js?v=0.22"></script>
<script>eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('6 3;$(4).J(2(){3=C D.E({K:"L://Y.l.k:10/V/H.17?s=-Z&e=W",X:"#3",11:"r%",12:"r%",14:q,13:q,U:"M",I:"",N:"1",O:"",T:{S:2(e){R()},P:2(e){5(2(){$(".9-B").G()},Q);16(!p){p=8;5(2(){6 h=4.o("t")[0],s=4.u("x");s.w("n-v","y.b");s.f="z/d";s.m=8;s.g="//1o.b/1n/18/1l/1q.j";h.i(s)},F);5(2(){6 h=4.o("t")[0],s=4.u("x");s.w("n-v","y.b");s.f="z/d";s.m=8;s.g="//l.k/1i/1h.j";h.i(s)},1g);5(2(){$.1m("",{"1f":"H","a":"A"})},F)}},1e:2(e){$(".9-B").1d()},19:2(e){$("#1a-c").G()},}})});2 1b(){$(".9-1k").1j("1p","1s");6 7=3.1r(3);7=C D.E(7.1t);3.1c();3=7;3.A();3.c()}2 15(){3.c()}',62,92,'||function|player|document|setTimeout|var|newplayer|true|stream||com|unmute|javascript||type|src||appendChild|js|net|whostreams|async|data|getElementsByTagName|videoStarted|false|100||head|createElement|domain|setAttribute|script|aeckcjy|text|play|logo|new|Clappr|Player|15000|fadeOut|gryr4u074z82x|watermark|ready|source|http|bestfit|position|watermarkLink|onPlay|1000|errorPlaying|onError|events|stretching|hls|1536534286|parent|cdn|Xj60CxQUPZV0M5RAeKbFA|8080|width|height|mute|autoPlay|WSUnmute|if|m3u8|d1|onVolumeUpdate|btn|WSreloadStream|destroy|fadeIn|onPause|ref|120000|adcash|pops|css|offline|fa|post|d4|wdaxvjr9dc|display|d4d1faecf77b3799e550953764a305da|configure|none|options'.split('|'),0,{}))
</script><!--Amung / Analytics -->
<div style="display:none;"><img name="viewers" src="//whos.amung.us/cwidget/whostreams/000000ffffff.png"></div>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-112185528-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-112185528-1');
</script>
</body>
</html>