Skip to content

Commit 1214c5f

Browse files
author
Jim
committed
Updated the google_oauth library to allow debug information to be written to the log. Also changed the way the curl header was being set because it was not being set correctly, though it didn't seem to cause an issue.
1 parent d1df6c2 commit 1214c5f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

libraries/google_oauth.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class google_oauth
4444
//google service you are authenticating against.
4545
const SCOPE = 'https://gdata.youtube.com'; //YouTube
4646

47+
//Set this flag to true for detailed logging.
48+
const DEBUG = false;
49+
4750
//Array that should contain the consumer secret and
4851
//key which should be passed into the constructor.
4952
private $_consumer = false;
@@ -162,9 +165,16 @@ private function _connect($url, $auth)
162165
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
163166
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
164167
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
165-
curl_setopt($ch, CURLOPT_HTTPHEADER, array($auth));
168+
curl_setopt($ch, CURLOPT_HTTPHEADER, explode("\r\n", $auth));
169+
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
166170

167171
$response = curl_exec($ch);
172+
173+
if(self::DEBUG)
174+
{
175+
error_log(print_r(curl_getinfo($ch), true));
176+
error_log($response);
177+
}
168178
curl_close($ch);
169179
return $response;
170180
}

0 commit comments

Comments
 (0)