-
Make sure there is a mongodb instance running locally.
-
First export the environment variables.
export CLIENT_ID=your-client-id
export CLIENT_SECRET=your-client-secret
export DOMAIN_URL=your-domain-url| <?php | |
| require __DIR__ . '/vendor/autoload.php'; | |
| $response = Unirest\Request::get('https://api.github.com/repos/twilio/twilio-php/contributors'); | |
| print_r($response->body); |
| <?php | |
| require __DIR__ . '/vendor/autoload.php'; | |
| use GuzzleHttp\Client; | |
| $client = new Client([ | |
| 'base_uri' => 'https://api.github.com', | |
| 'timeout' => 5.0, | |
| ]); |
| <?php | |
| require __DIR__ . '/vendor/autoload.php'; | |
| $url = "https://api.github.com/repos/twilio/twilio-php/contributors"; | |
| $response = \Httpful\Request::get($url)->expectsJson()->send(); | |
| print_r($response->body); |
| <?php | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, array("user-agent: my app")); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($ch, CURLOPT_URL, "https://api.github.com/repos/twilio/twilio-php/contributors"); | |
| $result = curl_exec($ch); | |
| curl_close($ch); |
| # remember to add the dependency > pip install requests | |
| import requests | |
| url = 'https://api.github.com/repos/twilio/twilio-python/contributors' | |
| print(requests.get(url).json()) |
| import urllib.request | |
| url = 'https://api.github.com/repos/twilio/twilio-python/contributors' | |
| response = urllib.request.urlopen(url).read() | |
| print(response) |
| # Remember to add the dependency > pip install unirest | |
| from tornado.httpclient import HTTPClient | |
| from tornado.httpclient import AsyncHTTPClient | |
| import tornado.ioloop | |
| url = 'https://api.github.com/repos/twilio/twilio-node/contributors' | |
| headers = {'user-agent': 'my app'} | |
| # Synchronous | |
| http_client = HTTPClient() |
| import http.client | |
| conn = http.client.HTTPSConnection("api.github.com") | |
| conn.request(method="GET", url="/repos/twilio/twilio-python/contributors", | |
| headers={'user-agent': 'My App'}) | |
| r1 = conn.getresponse() | |
| data1 = r1.read() | |
| print(data1) | |
| conn.close() |