url不使用php curl [英] Url not using php curl

查看:198
本文介绍了url不使用php curl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图打开一个https网址,但它不工作。它的工作其他https网站,但对于这是不工作。我不知道为什么它发生这样的原因。下面是代码我已经写了。
请帮助。

I am trying to open a https url but it is not working.It works for other https websites but for this it is not working.I don't know the reason why it is happening like that.Below is the code i have written. Please help.

<?php
 error_reporting(E_ALL);
 $url = "https://sgate.bmwgroup.com/login_common.fcc";
 $ch = curl_init($url);
 curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 200);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
 curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,1);
 curl_setopt($ch, CURLOPT_SSLVERSION, 3);
 curl_setopt($ch,CURLOPT_FOLLOWLOCATION,TRUE);
 curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2)          Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)" );
  $curl_scraped_page= curl_exec($ch);
  if(!$curl_scraped_page)
{
echo "first learn";
}
if(curl_errno($ch)) {
 echo 'Curl error: ' . curl_error($ch);
 }
 echo $curl_scraped_page;
 curl_close($ch);
 ?>    


推荐答案

网页正在运作的好消息,是使用javascript,而他没有得到他的脚本,页面不显示。而不是 echo $ curl_scraped_pa​​ge;
尝试使用:

good news that page is working, bad news that site is using javascript, and while he doesn't get his scripts, the page is not showing. instead of echo $curl_scraped_page; try to use:

var_dump(htmlspecialchars($curl_scraped_page));

这篇关于url不使用php curl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆