This afternoon, I found that a program I wrote was suddenly unable to be used for troubleshooting. The cause was that when PHPfile_get_contents was used to obtain JSON format data returned by a url, unexpected characters were added at the end. although the data format displayed on the webpage is normal...
This afternoon I found that a program I wrote was suddenly unavailable. The cause was that when I used PHP file_get_contents to retrieve JSON format data returned by a url, it was inexplicably added with unpredictable content at the end. character
Although the data format displayed on the webpage is normal, it is found that there are several characters at the end of the copy to the editor.
We can see that SOH characters are added to the end ..
Of course, the results returned by capturing the same link with php curl are in normal JSON format.
PS: PHP Version 5.4.12
What is the cause?
Reply content:
This afternoon I found that a program I wrote was suddenly unavailable. The cause was that when I used PHP file_get_contents to retrieve JSON format data returned by a url, it was inexplicably added with unpredictable content at the end. character
Although the data format displayed on the webpage is normal, it is found that there are several characters at the end of the copy to the editor.
We can see that SOH characters are added to the end ..
Of course, the results returned by capturing the same link with php curl are in normal JSON format.
PS: PHP Version 5.4.12
What is the cause?
Ascii control characters.
Refer:
Http://stackoverflow.com/questions/1497885/remove-control-characters-from-php-string
Http://blog.sina.com.cn/s/blog_4d6a2e4301018cx3.html
Ps: You are still using a public account ..