failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported

PHP analog GET request a refund Alipay links (links and unused request parameter sdk own mosaic);

起初用file_get_contents();就报错 :failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported!!!

Curl into an analog value is an empty right get request directly returns an empty string ,,, no error parameters that do not curl, various test life to suspect

Then continue to get $ info = curl_getinfo ($ ch); view information

Found http_code 505, said to be found does not support HTTP / 1.1 has (here is certainly not the reason) also said that the request format is wrong to  remove the spaces of

Directly URL preg_replace ( '# #', '', $ url) before requesting

Then Alipay returned wrong time parameter format is yyy-MM-dd HH: mm: ss middle space also can not live without  

See article addresses the issue:  https://blog.csdn.net/bianb123/article/details/81557300

preg_replace('# #','%20',$url);

Go back regardless file_get_contents (); or curl can be successful request, the long-awaited  

"code":"10000","msg":"Success"

Finally came out

Hereby record!

Guess you like

Origin www.cnblogs.com/yimingwang/p/11367245.html