Welcome Guest, Not a member yet? Register   Sign In
CurlRequest Class - getReason and getStatusCode missing
#1
Question 

Hi,
I am using CI 4.1.4 and testing the CurlRequest Class. I do not get any output for the getStatusCode and getReason methods as stated in the documentation. VS Code intelephense states that these 2 methods have been deprecated. I checked the class definition and i could not find these 2 methods either. The following is my code. Please help.

Code:
public function getcodes()
    {
        // echo "inside getcodes";
        $client = \Config\Services::curlrequest();

        $posts_data = $client->get("https://jsonplaceholder.typicode.com/posts", [
            "headers" => [
                "Accept" => "application/json",
            ],
        ]);

        echo "<pre>";
        echo $posts_data->getReason();
        echo "=====================================<br><br>";
        echo $posts_data->getStatusCode();
        echo "=====================================<br><br>";
        print_r($posts_data->getBody());
        echo "</pre>";
    }
Reply




Theme © iAndrew 2016 - Forum software by © MyBB