PHP Curl Error 35 Peer报告它遇到内部错误 [英] PHP Curl Error 35 Peer reports it experienced an internal error

查看:126
本文介绍了PHP Curl Error 35 Peer报告它遇到内部错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码来使PHP Curl工作: 我拥有使用api的域,并且可以对其运行的服务器进行任何更改.

I am trying to get PHP Curl working using the following code: I own the domain that is using the api and I can make any changes to the server that it is running on.

<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);

$data = array("username" => "derped", "authid" => "987654321", "ipaddress" => "1.2.3.4", "apikey" => "1234567829");
$data_string = json_encode($data);
$url = 'https://www.somedomain.com/test/api.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: Content-Type: text/html'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
if(curl_exec($ch) === false)
{
    echo curl_error($ch);
}
else
{
    echo 'ok';
}

curl_close($ch);

$received = json_decode($result);
$check = $received->{'good'};
echo $result;
echo $check;
?>

Curl返回错误:对等方报告它遇到内部错误. 当我卷曲域本身( https://www.somedomain.com )时,它会返回相同的错误.即使当我通过终端使用curl时,它也会返回35错误,但是当我尝试在不使用HTTPS的情况下对域进行卷曲时,它会返回找到的302,但是由于我的域仅为https,因此这不是解决方案,它只会显示移动页面.我知道这与使用https进行卷曲有关,但是 https://www.google.com 有效,所以我不知道从哪里开始...

Curl returns the error: Peer reports it experienced an internal error. When I curl the domain itself (https://www.somedomain.com) it returns the same error. Even when I use curl via the terminal it returns the 35 error, but when I try to curl the domain without HTTPS it returns the 302 found but since my domain is https only this will not be the solution, it just echos the move page. I know this has something todo with curl using https but https://www.google.com works so I dont know where to start...

推荐答案

$arrayCiphers = array(
    'DHE-RSA-AES256-SHA',
    'DHE-DSS-AES256-SHA',
    'AES256-SHA:KRB5-DES-CBC3-MD5',
    'KRB5-DES-CBC3-SHA',
    'EDH-RSA-DES-CBC3-SHA',
    'EDH-DSS-DES-CBC3-SHA',
    'DES-CBC3-SHA:DES-CBC3-MD5',
    'DHE-RSA-AES128-SHA',
    'DHE-DSS-AES128-SHA',
    'AES128-SHA:RC2-CBC-MD5',
    'KRB5-RC4-MD5:KRB5-RC4-SHA',
    'RC4-SHA:RC4-MD5:RC4-MD5',
    'KRB5-DES-CBC-MD5',
    'KRB5-DES-CBC-SHA',
    'EDH-RSA-DES-CBC-SHA',
    'EDH-DSS-DES-CBC-SHA:DES-CBC-SHA',
    'DES-CBC-MD5:EXP-KRB5-RC2-CBC-MD5',
    'EXP-KRB5-DES-CBC-MD5',
    'EXP-KRB5-RC2-CBC-SHA',
    'EXP-KRB5-DES-CBC-SHA',
    'EXP-EDH-RSA-DES-CBC-SHA',
    'EXP-EDH-DSS-DES-CBC-SHA',
    'EXP-DES-CBC-SHA',
    'EXP-RC2-CBC-MD5',
    'EXP-RC2-CBC-MD5',
    'EXP-KRB5-RC4-MD5',
    'EXP-KRB5-RC4-SHA',
    'EXP-RC4-MD5:EXP-RC4-MD5');

curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, implode(':', $arrayCiphers));

这篇关于PHP Curl Error 35 Peer报告它遇到内部错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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