Curl requests the https URL, which causes the connection to be reset after I open the web page.

WBOY
Release: 2016-10-10 11:56:03
Original
3335 people have browsed it

Today, I deployed an older program on Alibaba Cloud, using Alibaba Cloud's esc. The environment is as follows:

  • PHP Version 5.2.17

  • Apache/2.2.29 (Unix)

  • Mysql 5.1.73

The index.php file contains the following code

<code>$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'http://www.baidu.com/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$info = curl_exec($ch);
curl_close($ch);
echo $info;</code>
Copy after login
Copy after login

When I visit domain name/index.php, the Baidu page appears normally.
But after I made some modifications, the connection was reset and the connection was reset. I searched online and found no effective solution.

<code>$ch = curl_init();

curl_setopt($ch,CURLOPT_URL,'https://www.baidu.com/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$info = curl_exec($ch);
curl_close($ch);
echo $info;</code>
Copy after login
Copy after login

Curl requests the https URL, which causes the connection to be reset after I open the web page.

What causes this problem? Is it a php version problem or some other reason? Thank you for your help!

Reply content:

Today, I deployed an older program on Alibaba Cloud, using Alibaba Cloud's esc. The environment is as follows:

  • PHP Version 5.2.17

  • Apache/2.2.29 (Unix)

  • Mysql 5.1.73

The index.php file contains the following code

<code>$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,'http://www.baidu.com/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
//curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$info = curl_exec($ch);
curl_close($ch);
echo $info;</code>
Copy after login
Copy after login

When I visit domain name/index.php, the Baidu page appears normally.
But after I made some modifications, the connection was reset. I searched online and found no effective solution.

<code>$ch = curl_init();

curl_setopt($ch,CURLOPT_URL,'https://www.baidu.com/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$info = curl_exec($ch);
curl_close($ch);
echo $info;</code>
Copy after login
Copy after login

Curl requests the https URL, which causes the connection to be reset after I open the web page.

What causes this problem? Is it a php version problem or some other reason? Thank you for your help!

What era is it, still using 5.2. . . . . . . .

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template