PHP cURL:CURLOPT_USERPWD上的最大长度? [英] PHP cURL: Max Length on CURLOPT_USERPWD?

查看:220
本文介绍了PHP cURL:CURLOPT_USERPWD上的最大长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用cURL在PHP中有一个简单的GET请求。

I have a simple GET request in PHP using cURL. It is using basic auth for authentication.

但是当{username}:{password}长度超过266个字符时,它似乎被截断。我看起来无处不在,但没有找到任何文件说明这一点。只是我吗?

However when the {username}:{password} is longer than 266 characters, it appears to be getting truncated. I looked everywhere but haven't found any documentation stating this. Is it just me?

$data = curl_init($url);

curl_setopt($data, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($data, CURLOPT_HTTPAUTH, CURLAUTH_ANY);

$results = curl_exec($data);

echo $results;

curl_close($data);


推荐答案

我不是C专家,下面的代码在CURL源(!不是php扩展,但原来的curl)
看起来像CURL只分配256byte的密码。

I'm not a C expert but I found the following code in the CURL source (!NOT the php extension but the original curl) Looks like CURL only allocates 256byte for the password.


删除旧代码,因为正如Daniel Steinberg所述,此代码不再使用。

EDIT Removed the old code, because as Daniel Steinberg stated below this code is not used anymore.

这篇关于PHP cURL:CURLOPT_USERPWD上的最大长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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