set_credentials ( $user, $pass )

Sets the credentials to use for authentication.

Access

public

Parameters

Parameter

Type

Required

Description

$user

string

Required

The username to authenticate with.

$pass

string

Required

The password to authenticate with.

Returns

Type

Description

$this

A reference to the current instance.

Examples

Pass credentials to set_credentials(), and display the username to use.

$http = new RequestCore('http://github.com/skyzyx/requestcore/raw/master/_tests/test_request.txt');
$http->set_credentials('user', 'pass');
$http->prep_request();

var_dump($http->username);
Result:
string(4) "user"

Pass credentials to set_credentials(), and display the password to use.

$http = new RequestCore('http://github.com/skyzyx/requestcore/raw/master/_tests/test_request.txt');
$http->set_credentials('user', 'pass');
$http->prep_request();

var_dump($http->password);
Result:
string(4) "pass"

Source

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback