ads - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of ads.php
- <?php
- // Auth0 API endpoint to retrieve connections
- $auth0_url = 'https://dev-fow9p8vk.us.auth0.com/api/v2/connections';
- // Auth0 API token
- $auth0_token = '63188f37e12aa51fabb7b6dd';
- // Set up cURL
- $ch = curl_init();
- // Set the cURL options
- curl_setopt($ch, CURLOPT_URL, $auth0_url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Authorization: Bearer ' . $auth0_token
- ));
- // Execute the cURL request
- $response = curl_exec($ch);
- // Check for errors
- if ($response === false) {
- echo 'cURL error: ' . curl_error($ch);
- } else {
- // Decode the JSON response
- $connections = json_decode($response, true);
- // Check if connections are retrieved successfully
- if (isset($connections['strategies']) && !empty($connections['strategies'])) {
- // Display the social connections
- echo "Social Connections available:\n";
- foreach ($connections['strategies'] as $strategy) {
- echo $strategy['name'] . "\n";
- }
- } else {
- echo "No social connections found.";
- }
- }
- // Close cURL session
- curl_close($ch);
- ?>
File Description
- ads
- PHP Code
- 29 Jan-2024
- 1.17 Kb
You can Share it:
Latest PHP Pastes