$xml_file = file_get_contents(SITE_PATH . 'cms/data.php');
Run Code Online (Sandbox Code Playgroud)
问题是服务器禁用了URL文件访问.我无法启用它,它是托管的东西.
所以问题是这个.该data.php文件生成xml代码.
如何在不执行上述方法的情况下执行此操作并获取xml数据?
可能吗?
我正在建立一个个人股票平台(未分发).我想要的组件是此页面上的EPS图表:
正如你所看到的那样,页面是https这样的,所以经过几天的讨论后,我启用了openssl,现在它似乎适用于所有https页面,例如facebook和twitter的主页,但它仍然不能用于我需要的那个.
file_get_contents('https://facebook.com'); /* works */
file_get_contents('https://twittercom'); /* works */
file_get_contents('https://eresearch.fidelity.com/eresearch/evaluate/fundamentals/earnings.jhtml?stockspage=earnings&symbols=AAPL&showPriceLine=yes');
Run Code Online (Sandbox Code Playgroud)
我收到了警告:
Warning: file_get_contents(): SSL: crypto enabling timeout in C:\xampp\htdocs\index.php on line 3
Warning: file_get_contents(): Failed to enable crypto in C:\xampp\htdocs\index.php on line 3
Warning: file_get_contents(https://eresearch.fidelity.com/eresearch/evaluate/fundamentals/earnings.jhtml?stockspage=earnings&symbols=AAPL&showPriceLine=yes): failed to open stream: operation failed in C:\xampp\htdocs\index.php on line 3
Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\index.php on line 3
Run Code Online (Sandbox Code Playgroud)
我能看到的唯一区别是保真度页面在https标签附近有一个三角形.

使用https:// urls调用file_get_contents()会出现以下错误:
warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?
Run Code Online (Sandbox Code Playgroud)
我已经阅读了10多个SO问题,所有人都说要启用 extension=php_openssl.dll
我这样做了,我还有问题......
还有什么呢?
我多年来一直file_get_contents用来抓住网站的内容.
最近,他们更新了他们的URL HTTPS并file_get_contents停止了工作.
我已经阅读过以前的问题并尝试过标记的解决方案,但没有任何效果.
例如,我试过这个,它返回以下内容:
openssl: yes http wrapper: yes https wrapper: yes wrappers: array ( 0 => 'https', 1 => 'ftps', 2 => 'compress.zlib', 3 => 'compress.bzip2', 4 => 'php', 5 => 'file', 6 => 'data', 7 => 'http', 8 => 'ftp', 9 => 'zip', )
Run Code Online (Sandbox Code Playgroud)
于是我尝试这个解决方案有file_get_contents,但没有成功.
然后,我尝试这种解决方案具有cURL完全忽略加密,无济于事
无论我尝试哪种解决方案,都不会返回任何内容.
我还没有加入extension=php_openssl.dll,并allow_url_include = On以PHP.ini按照 …
当我尝试从谷歌获取图像并且它为单次搜索提供4个图像时,由于图像大小,我无法获得一些图像.所以我得到的错误就像
"file_get_contents():无法启用加密"
有什么解决方案吗?这是我的代码
<?php
use frontend\models\Giftinterests;
use yii\amazonproductapi\AmazonProductAPI;
use yii\helpers\Url;
use yii\web\NotFoundHttpException;
use yii\image\ImageDriver;
$sql_1 = 'SELECT * FROM `tn_gift_interests` where `gift_interest_status`="1" order by `gift_interest_id` ASC';
$Query_Gift = Giftinterests::findBySql($sql_1)->all();
$sql_2="TRUNCATE `tn_gift_google_image`";
$query_1 = Yii::$app->db->createCommand($sql_2)->execute();
function get_url_contents($url) {
$crl = curl_init();
curl_setopt($crl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
curl_setopt($crl, CURLOPT_URL, $url);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($crl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($crl, CURLOPT_SSLVERSION,3);
curl_setopt($crl, CURLOPT_SSL_VERIFYPEER, true);
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}
$width=260;$height=229;
$a=0;
foreach($Query_Gift as $two):
$a++;
$amazon …Run Code Online (Sandbox Code Playgroud) 我正在使用类似的代码
<?php
$url = 'http://www.example.com';
if(isset($_GET['url'])){$url = $_GET['url'];}
$array = get_headers($url);
$string = $array[0];
if(strpos($string,"200")){
echo 'url exists';
}
else{
echo 'url does not exist';
}
//this code does not works for ssl connection
?>
Run Code Online (Sandbox Code Playgroud)
检查网址是否存在,但它不适用于使用 ssl 连接的网站,我的意思是https://www.example.com类型的网站
我有这个公共JSON https://raw.github.com/currencybot/open-exchange-rates/master/latest.json,我需要从中提取数据,现在我尝试过这样的事情:
$input = file_get_contents("https://raw.github.com/currencybot/open-exchange-rates/master/latest.json");
$json = json_decode($input);
echo $json[rates]->EUR;
Run Code Online (Sandbox Code Playgroud)
但我得到一个空白页,任何建议?谢谢 !!STE
您好,我正在使用下面的代码从 url 下载图像,但当我使用此代码时它不起作用
<?php
$imageUrl = 'https://cwsimages.ingramtest.com/cdsImages/imageloader?id=pBbFysOWRLJoSy4l4lbc+yLblU6JMuhKpze3XsQNO+njA3/XYRYbXSEYYsSqKXoiGD07duAyOSVXNUVLvxDqlMx15WtRQWJn3xC/twmM2s62tw+XgriCmEXBHawun03pQLBHXLuEQhNmCb8MC3ZMNH7pe5O76s18u/mgplf8YtU=';
@$rawImage = file_get_contents($imageUrl);
if($rawImage)
{
file_put_contents("images/".'dummy1.png',$rawImage);
echo 'Image Saved';
}
else
{
echo 'Error Occured';
}
?>
Run Code Online (Sandbox Code Playgroud)
但如果我用这个改变 $imageUrl
$imageUrl = 'http://www.samsung.com/in/common/img/home/S2_pc.png';
Run Code Online (Sandbox Code Playgroud)
它有效,请建议第一个网址有什么问题,或者我们不能存储 https 网址中的图像
可能重复:
file_get_contents与https?
使用SimpleXML和PHP通过https获取XML内容的问题
我有网址:
哪个加载像这样的文件:
<calendars>
<calendar accommodation_id="1234567">
<day date="2012-08-09" vacancy="false" minimum_nights="7" arrival_day="true"/>
<day date="2012-08-10" vacancy="false" minimum_nights="3" arrival_day="true"/>
<day date="2012-08-11" vacancy="false" minimum_nights="3" arrival_day="true"/>
...
<day date="2014-01-31" vacancy="true" minimum_nights="3" arrival_day="true"/>
</calendar>
</calendars>
Run Code Online (Sandbox Code Playgroud)
出于某种原因,我的脚本不会让我获取此文件的内容.我正在使用与其他URL相同的脚本,但这总是会失败.
我的脚本是:
$accom2 = file_get_contents();
print_r($accom2);
Run Code Online (Sandbox Code Playgroud)
我需要为这种类型的URL做些什么吗?