As we know we can only read a specific number of bytes from the response.
How to read the whole response in one socket_read function call ?
As we know we can only read a specific number of bytes from the
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Write your own read function that keeps calling
socket_readuntil you have the ‘whole response’. How you do that will depend on exactly what a ‘whole response’ is. (That’s why PHP can’t do it for you. It has no idea what you consider to be a ‘whole response’. Only you do.)Whatever protocol you are implementing will tell you how to tell if you’ve gotten a whole response. You have to actually implement that protocol.