andrefadila
andrefadila

Reputation: 687

Yii Curl wrapper set Authorization header

I've been using this Curl wrapper in Yii : hackerone curl

I am trying to send authorization bearer token in header with this code:

$auth = array("Authorization: Bearer".$token);
// I am tried this too
//$auth = array("Authorization" => "Bearer".$token);
$jsonObject = Yii::app()->curl->setOption(CURLOPT_HTTPHEADER, $auth)->get($url);

But I got same error result, the error says :

Undefined index: scheme 
Error in Curl.php line 93 <- that wrapper

Does anyone got this problem too?

I have not found the right code for this problem.

Thanks in advance.

Upvotes: 0

Views: 778

Answers (1)

Larry.Z
Larry.Z

Reputation: 3724

I have check the code in hackernon curl. I think the problem is that $url value doesn't have schema like http://.

$url = 'http://www.google.com' // good 
$url = 'www.google.com' // bad

Upvotes: 0

Related Questions