Base64编码的pdf字符串破坏api
我有一个 POST 请求,其中包含一个带有表示 pdf 的 base64 字符串的 json,该请求失败,我正在尝试找出解决方案。
我以为它只是使用 url_encode 对其进行编码,但当我解码它时,它似乎丢失了部分数据。
我尝试使用数组中的 PHP json 编码,但出现同样的问题。
该字符串的长度可能超过 25000 个字符,但不确定。如果有人遇到过此问题并有解决方案,请分享
$pdf = (isset($params['pdf']) && $params['pdf'] != "" ? $params['pdf'] : null);
请在下面找到有效负载的示例
https://pastebin。 com/JK8zTsAG
注意:他们不断删除我的 Pastebin -
{
"id":"5555555",
"pdf": "7CfNe3nszmfAFMOAc3jgsgTMGEfDIMQzCxTvwAMIwgtUKEy9ikGKGCR6fN8LMmj"
}
上面的方法运行良好,但如果我添加真正的 pdf Base64 字符串,它就会中断,因为它的长度超过 20k。
简而言之 : 我在pastebin中接收有效负载,它包含一个代表pdf的base64字符串,但是当我收到pdf字符串(实际上超过20k个字符)时,它破坏了api。
I have POST request which contains a json with a base64 string which represents a pdf, this requests fails and I am trying to figure out a solution to it.
I thought it was just encoding it using url_encode but then it seems to lose part of the data when i decode it.
I tried using PHP json encode from the array but same issue.
It might be that the string is more than 25000 chars long but not sure. if someone have ever encountered this issue and have a solution please share it
$pdf = (isset($params['pdf']) && $params['pdf'] != "" ? $params['pdf'] : null);
Please find below a sample of the payload
NOTE: they keep removing my pastebin -
{
"id":"5555555",
"pdf": "7CfNe3nszmfAFMOAc3jgsgTMGEfDIMQzCxTvwAMIwgtUKEy9ikGKGCR6fN8LMmj"
}
The above works well but if I add the real pdf base64 string it breaks since its over 20k long.
In short :
I am receiving the payload in the pastebin, it contains a base64 string which represents a pdf but when I receive the pdf string (which is really long over 20k characters) it breaks the api.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论