简体   繁体   中英

Url not using php curl

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);
 ?>    

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));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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