code push
This commit is contained in:
34
test-ajax-response.php
Normal file
34
test-ajax-response.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Test what the AJAX method actually returns
|
||||
*/
|
||||
|
||||
// Load WordPress
|
||||
$wp_load_path = dirname(dirname(dirname(dirname(__FILE__)))) . '/wp-load.php';
|
||||
require_once $wp_load_path;
|
||||
|
||||
// Load the plugin
|
||||
require_once __DIR__ . '/includes/class-twp-twilio-api.php';
|
||||
|
||||
// Create API instance
|
||||
$api = new TWP_Twilio_API();
|
||||
|
||||
// Get phone numbers
|
||||
$response = $api->get_phone_numbers();
|
||||
|
||||
echo "API Response:\n";
|
||||
echo "=============\n";
|
||||
print_r($response);
|
||||
|
||||
if ($response['success'] && !empty($response['data']['incoming_phone_numbers'])) {
|
||||
echo "\nFirst phone number data:\n";
|
||||
echo "========================\n";
|
||||
$first = $response['data']['incoming_phone_numbers'][0];
|
||||
foreach ($first as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
echo "$key: " . json_encode($value) . "\n";
|
||||
} else {
|
||||
echo "$key: $value\n";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user