Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url = 'https://[your-url-here]';
- //Basic Auth
- $username = 'your_user_name';
- $password = 'SomePassWord';
- $str = $username . ":" . $password;
- $encoded = base64_encode($str);
- // HTTP Header
- $accesstoken = $encoded;
- $headr = array();
- $headr[] = 'Accept: application/json';
- $headr[] = 'Authorization: Basic '.$accesstoken;
- //cURL starts
- $crl = curl_init();
- curl_setopt($crl, CURLOPT_URL, $url);
- curl_setopt($crl, CURLOPT_HTTPHEADER,$headr);
- curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($crl, CURLOPT_HTTPGET,true);
- $your_reply = curl_exec($crl);
- ?>
Add Comment
Please, Sign In to add comment