繁体   English   中英

PHP卷曲问题加载空白页

[英]PHP curl issue loading blank page

我正试图通过这个片段显示一个表格,我似乎无法让它显示出来。 它加载一个空白页面。 当我转到URL本身时,它会加载模板,但是想要从URL中提取表并使用php显示。

有人可以给我指点吗?

这是代码

<?php
$handle = curl_init();
curl_setopt ($handle, CURLOPT_URL," https://api.aghost.net/api/futures/index.cfm/");
curl_setopt ($handle, CURLOPT_POSTFIELDS,     "username=E006520104&password=KRKwev!96&service=table&symbols=@LE6,@GF6,@KW6,@C6,@S6&style=6&layout=grouped&tableWidth=350px&fontSize=0.65em&firstColLabel=Month&oddRowBgColor=%23EAEAEA&columns=high,low,last,change&commRowBgColor=%23009900&commRowTextColor=%23FFFFFF&labelTextColor=%23009900&exchangeByComm=1");
curl_setopt ($handle, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($handle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt ($handle, CURLOPT_FRESH_CONNECT, TRUE);
curl_exec ($handle);
curl_close($handle);
?>

试试这个 - >

<?php
$handle = curl_init();
curl_setopt ($handle, CURLOPT_URL,"https://api.aghost.net/api/futures/index.cfm/");
curl_setopt($handle,CURLOPT_POST, 1);
curl_setopt ($handle, CURLOPT_POSTFIELDS,     "username=E006520104&password=KRKwev!96&service=table&symbols=@LE6,@GF6,@KW6,@C6,@S6&style=6&layout=grouped&tableWidth=350px&fontSize=0.65em&firstColLabel=Month&oddRowBgColor=%23EAEAEA&columns=high,low,last,change&commRowBgColor=%23009900&commRowTextColor=%23FFFFFF&labelTextColor=%23009900&exchangeByComm=1");
curl_setopt ($handle, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($handle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt ($handle, CURLOPT_FRESH_CONNECT, TRUE);
$output = curl_exec ($handle);
curl_close($handle);
echo $output;
?>

如果它仍然工作,你卷曲的网站可能需要使用useragent varification。 在这种情况下,使用CURLOPT_USERAGENT

当您将CURLOPT_RETURNTRANSFER选项设置为true时, curl_exec将返回结果数据而不是将其转储出去。

成功时返回TRUE,失败时返回FALSE。 但是,如果设置了CURLOPT_RETURNTRANSFER选项,它将在成功时返回结果,在失败时返回FALSE。

CURLOPT_RETURNTRANSFER为false或在收到后存储并打印结果。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM