Deeban Babu
Deeban Babu

Reputation: 729

Webservice response in yii2 framework

I am new to yii framework

I tried web service response using curl post but I receive error code on response

$curl = new curl\Curl();    

        $response = $curl->setOption(
                CURLOPT_POSTFIELDS, 
                http_build_query(array(
                    'email' => 'sfdsdfsdf',
                    'access_token' => 'fdsdsfsdfsdf',
                    'auth_type' => 'fdsfsfsdfsd'
                )
            ))
            ->post('http://example.com/login/');
var_dump($curl->responseCode); - 404

I tried above code.

Upvotes: 2

Views: 111

Answers (1)

lennartvdd
lennartvdd

Reputation: 505

That URL http://example.com/login/ does not exist, and correctly responds with a HTTP 404 error: Page Not Found. (also see: List of HTTP Status Codes)

It seems your code is functioning. You may want to change the example.com url to your actual endpoint.

Upvotes: 1

Related Questions