php-mod / curl

This library provides an object-oriented and dependency free wrapper of the PHP cURL extension.
MIT License
328 stars 120 forks source link

curl->response seem to be uncomparable #29

Closed mbalandis closed 7 years ago

mbalandis commented 7 years ago

Let's say you have a page that just echo or dies a response. For example, echo "hi" or die("hi"); Using syntax like this:

                            if ($curl->error) {
                                echo $curl->error_code;
                            } else {
                                if ($curl->response === "hi") {
                                 echo "response worked";
                                }
                            }

I am unable to get "response worked" no matter what. Even though echo $curl->response returns "hi" just fine. I var_dump'ed it and difference is that it has different size string but still it should work because it is same type (hence triple equals). Doesn't work with double equals too. I got it work by checking if it contains "hi" and that seems to work but it seems to be a bit excessive. Am I doing something wrong?

amouhzi commented 7 years ago

Hello okeniiawak,

Can you show me the full code, I nee to see how do you use the Curl call. then I can help you.

mbalandis commented 7 years ago

@amouhzi

I cannot share publicly the code I have as it is proprietary. I have tried to make a sample code but it seems to work every time now. It must be some sort of strange glitch when used with other library or something. When comparing it does not make sense why one works but other doesn't. Sorry for potential false alarm. Closing issue for now, I will reopen it when I figure it out and if the problem is important and it is from your side.