我想在我的页面中加载irctc.co.in页面。为什么我的页面无法正常工作,当我在我的网址中添加www.irctc.co.in然后页面重定向在该网站上,同时它的工作正常。所以请告诉我它不会在我的网页上加载网站的网站上重定向。
<?php
// URLs we want to retrieve
$urls = array(
'http://www.google.com',
'http://www.bing.com',
'http://www.yahoo.com',
'http://www.twitter.com',
'http://www.facebook.com',
'www.irctc.co.in' //it creates problem WHY
);
// initialize the multihandler
$mh = curl_multi_init();
$channels = array();
foreach ($urls as $key => $url) {
// initiate individual channel
$channels[$key] = curl_init();
curl_setopt_array($channels[$key], array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true
));
// add channel to multihandler
curl_multi_add_handle($mh, $channels[$key]);
}
// execute - if there is an active connection then keep looping
$active = null;
do {
$status = curl_multi_exec($mh, $active);
}
while ($active && $status == CURLM_OK);
// echo the content, remove the handlers, then close them
foreach ($channels as $chan) {
echo curl_multi_getcontent($chan);
curl_multi_remove_handle($mh, $chan);
curl_close($chan);
}
// close the multihandler
curl_multi_close($mh);
答案 0 :(得分:1)
在https://
之前添加www.irctc.co.in
,您还需要启用此cURL参数。
CURLOPT_SSLVERIFYPEER => false