private function dropbox::_connect in Dropbox Client 7
Same name and namespace in other branches
- 7.4 dropbox.php \dropbox::_connect()
- 7.2 dropbox.php \dropbox::_connect()
- 7.3 dropbox.php \dropbox::_connect()
5 calls to dropbox::_connect()
- dropbox::get_access_token in ./
dropbox.php - This is called to finish the oauth token exchange. This too should only need to be called once for a user. The token returned should be stored in your database for that particular user.
- dropbox::get_request_token in ./
dropbox.php - This is called to begin the oauth token exchange. This should only need to be called once for a user, provided they allow oauth access. It will return a URL that your site should redirect to, allowing the user to login and accept your application.
- dropbox::_content_request in ./
dropbox.php - dropbox::_post_request in ./
dropbox.php - dropbox::_response_request in ./
dropbox.php
File
- ./
dropbox.php, line 437
Class
Code
private function _connect($url, $header, $request, $postdata = false, $destination = false) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $request);
curl_setopt($ch, CURLOPT_HTTPHEADER, explode(self::LINE_END, $header));
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
if (is_array($postdata)) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
}
$response = curl_exec($ch);
if (self::DEBUG) {
error_log(print_r(curl_getinfo($ch), true));
error_log($response);
}
//If the specified a destination and the request went OK write the file.
if ($destination !== false && curl_getinfo($ch, CURLINFO_HTTP_CODE) == '200') {
$fh = fopen($destination, 'w');
fwrite($fh, $response);
if ($fh !== false) {
fclose($fh);
}
}
curl_close($ch);
return $response;
}