您的位置 首页 php

PHP接口–curl请求导致接收到报文不完整解决办法

本篇文章的主要内容是关于PHP接口问题,当head头的编码与body报文编码不一致,curl请求导致接收到的报文不完整,感兴趣的朋友可以了解一下。

问    题:

    比如某次对接过程中,对方返回的head头是gbk编码(Content-type: text/xml; charset=GBK),但是body里面的报文是UTF-8编码,导致返回的报文不完整

详细描述:

    具体原因是因为GBK编码,一个中文字符是占用两个字节,而UTF-8编码一个中文字符是占用三个字节,curl请求响应回来的字符长度是按照GBK编码计算的,导致计算出来的报文字符长度是小于实际长度的,所以读取响应数据的时候,读到计算出来的长度时候就停止了,也就会出现返回的报文不完整情况

解决方案:

    不采用curl方法进行请求,改用file_get_contents方法,因为file_get_contents不会返回head信息,所以不会出现编码不一致的情况

相关教程:PHP视频教程

以上就是PHP接口–curl请求导致接收到报文不完整解决办法的详细内容,更多请关注求知技术网其它相关文章!

文章来源:智云一二三科技

文章标题:PHP接口–curl请求导致接收到报文不完整解决办法

文章地址:https://www.zhihuclub.com/5564.shtml

关于作者: 智云科技

热门文章

评论已关闭

26条评论

  1. Statistical analysis was obtained by combining three independent experiments of 12 mice vepesid augmentin duo 1gm dosage Australian dairy farmers have been battered in recent yearsby a powerful combination of factors, including a supermarketprice war that slashed domestic wholesale prices, a strongAustralian dollar that crimped exports and a drought that sentcattle feed costs soaring

  2. In a study of more than 3600 women with breast cancer who were age matched with control subjects, women who breast fed for at least 2 weeks had a modest decrease in breast cancer risk compared with women who never lactated 4 Combinational liposomes in brain tumors

  3. The rate of reoccurrence is apparently quite high in the original breast, and now I had an elevated risk in the other breast as well she said Patriot Games, Гў

  4. Adherence is constructed as the number of days of AI supplied divided by the number of days covered within a year For women, menopause is a complete cessation of reproductive ability, which usually starts around age 51

  5. Federal judges and prosecutors were also more likely than their state counterparts to be skeptical of the benefits of online criminal proceedings outside the context of the pandemic Autophagy was induced by environmental stress such as chemicals and toxins Lee et al

  6. The ancestor of the spirit demon wanted to do thyroid gland and high blood pressure Medicine For High Blood Pressure it again, but the ancestor of the sky demon said solemnly Hold on Stopped by the ancestor of the heavenly demon, the ancestor of the spirit demon was even more furious, and said coldly Wen Jing, you are a clan ancestor in vain As soon as Zhao Ling heard it, he knew why these people were chasing him, and said lightly With your cultivation base, I do not know how many generations have died before it was your turn to call yourself the ancestor of the family

  7. You should consult with your provider before becoming pregnant or fathering a child while on this medication Single cell RNA sequencing from human MFS aortic root aneurysm tissue confirmed analogous SMC modulation in clinical disease

  8. In early work, a hairpin pyrrole imidazole polyamide was designed to target the ARE to disrupt AR DBD binding and was effective at inhibiting androgen induced PSA expression in LNCaP cells 181 August 2002 again Bad Girl Cree k by Jo Ann Mapson first in trilogy tape Jolie Blon s Bounce by James Lee Burke America by Stephen Coonts The Smoke Jumper by Nicholas Evans Big Stone Gap by Adriana Trigiani Fearless Jones by Walter Mosley Partners In Crime by J

  9. Nonetheless, sympathetic innervation involves not only the kidneys but also all areas of the body

  10. Current, voltage, and mechanical signals were provided by the computer via a 12 bit D A converter and recorded via a 16 bit A D converter National Instruments, Austin, TX The study warned such heatwaves were now also up to 12 times more likely to occur, because of climate change

  11. Tanner, USA 2022 05 28 18 54 30 The related reported adverse reactions that occurred in 2 of patients were headache 5

  12. Furans 142 and 143 are reported to be improved oral cephalosporin type antibiotics when administered at the rate of 100 3000 mg d 1 85GEP O 3500090 dronedarone will increase the level or effect of clarithromycin by affecting hepatic intestinal enzyme CYP3A4 metabolism

  13. All patients were available to analyze testosterone recovery from the date at which the ADT reactive time had ended

  14. Therefore, we conclude that the abnormalities which we have observed are due to the long term estrogenic effects of these drugs

  15. Mathew, USA 2022 06 04 16 45 15 Ovariectomized athymic mice 10 group were implanted with tamoxifen naive T47D E2 breast tumors and treated with E 2 0

  16. DCIS, like invasive ductal carcinoma, occurs more frequently in women, although it accounts for approximately 5 of all male breast cancers

  17. These could yield 15 billion to 20 billioneuros in extra earnings by 2021 for European banks, according toconsultants McKinsey and industry body the European FinancialManagement and Marketing Association

  18. etravirine will decrease the level or effect of avapritinib by affecting hepatic intestinal enzyme CYP3A4 metabolism

  19. The wide range accounts for many variables including the woman s age, a healthy reproductive system and total sperm count

网站地图