viernes, 27 de enero de 2023

curl flowroute API

 <?php

$username="ambiorixg12";

$password="d9914a2s1111refadfe43";

$url = "https://api.flowroute.com/v2.1/messages";

$data = array(

    "to" => "12057143489",

    "from" => "18452375521",

    "body" => "jane_mc@gmail.com",

);

$encodedData = json_encode($data);

$curl = curl_init($url);

$data_string = urlencode(json_encode($data));

curl_setopt($curl, CURLOPT_USERPWD, $username . ":".$password);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");

curl_setopt( $curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));

curl_setopt($curl, CURLOPT_POST, true);

curl_setopt($curl, CURLOPT_POSTFIELDS, $encodedData);

$result = curl_exec($curl);

curl_close($curl);

print $result;


?>

https://developer.flowroute.com/api/messages/v2.1/send-an-sms/


https://phppot.com/php/php-curl-post/
curl version


curl https://api.flowroute.com/v2.1/messages \
-H "Content-Type: application/vnd.api+json" -X POST -d \
'{"to": "18412345676", "from": "18452375521", "body": "Hello World !"}' \
-u ambiorixg12:d99a3deadfe43

viernes, 13 de enero de 2023

gogle calendar

 -------------------

require_once __DIR__ . '/vendor/autoload.php';


// Get the API client and construct the service object.

$client = getClient();

$service = new Google_Service_Calendar($client);


// Define the event details.

$event = new Google_Service_Calendar_Event(array(

    'summary' => 'Test Event',

    'location' => 'Test Location',

    'description' => 'Test Description',

    'start' => array(

        'dateTime' => '2022-01-01T09:00:00-07:00',

        'timeZone' => 'America/Los_Angeles',

    ),

    'end' => array(

        'dateTime' => '2022-01-01T17:00:00-07:00',

        'timeZone' => 'America/Los_Angeles',

    ),

));


// Insert the event into the calendar.

$calendarId = 'primary';

$event = $service->events->insert($calendarId, $event);

---------------------------------------

require_once __DIR__ . '/vendor/autoload.php';

$client = new Google_Client();
$client->setApplicationName('My Calendar App');
$client->setScopes(Google_Service_Calendar::CALENDAR);
$client->setAuthConfig('credentials.json');
$client->setAccessType('offline');
$calendarService = new Google_Service_Calendar($client);

$event = new Google_Service_Calendar_Event(array(
  'summary' => 'Test Event',
  'location' => 'My House',
  'description' => 'Testing the calendar API',
  'start' => array(
    'dateTime' => '2022-03-28T09:00:00-07:00',
    'timeZone' => 'America/Los_Angeles',
  ),
  'end' => array(
    'dateTime' => '2022-03-28T17:00:00-07:00',
    'timeZone' => 'America/Los_Angeles',
  ),
  'recurrence' => array(
    'RRULE:FREQ=DAILY;COUNT=2'
  ),
  'attendees' => array(
    array('email' => 'attendee1@example.com'),
    array('email' => 'attendee2@example.com'),
  ),
  'reminders' => array(
    'useDefault' => FALSE,
    'overrides' => array(
      array('method' => 'email', 'minutes' => 24 * 60),
      array('method' => 'popup', 'minutes' => 10),
    ),
  ),
));

$calendarId = 'primary';
$event = $calendarService->events->insert($calendarId, $event);
printf('Event created: %s\n', $event->htmlLink);

------------------



To install the Google Calendar PHP REST API, you will need to use Composer, a package manager for PHP. Here are the general steps to install the API:

  1. Install Composer if you haven't already by following the instructions on their website: https://getcomposer.org/

  2. In your project directory, create a new file called "composer.json"

  3. In the composer.json file, add the following require statement: "require": { "google/apiclient": "^2.0" }

  4. Run the following command in your terminal: composer install

  5. In your PHP script, include the autoloader file by adding the following line at the top of your script: require_once 'vendor/autoload.php';

  6. Use the Google Calendar API by creating an instance of the Google_Client class and using its methods to interact with the Calendar API.

  7. You also need to setup a google project in order to get the credentials(client_id, client_secret, etc) to use it in your php script.

  8. Once you are authenticated and authorized, you can now use the Google Calendar API to manage calendar events, create new calendars, and more.

Please note that this is a high-level overview of the process and you should refer to the official documentation for more detailed instructions and examples: https://developers.google.com/calendar/api/v3/quickstart/php

domingo, 1 de enero de 2023

Mobile Responsive table

 <style>

table {
  border: 1px solid #ccc;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  width: 100%;
  table-layout: fixed;
}

table caption {
  font-size: 1.5em;
  margin: .5em 0 .75em;
}

table tr {
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  padding: .35em;
}

table th,
table td {
  padding: .625em;
  text-align: center;
}

table th {
  font-size: .85em;
  letter-spacing: .1em;
  text-transform: uppercase;
}

@media screen and (max-width: 600px) {
  table {
    border: 0;
  }

  table caption {
    font-size: 1.3em;
  }
  
  table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
  
  table tr {
    border-bottom: 3px solid #ddd;
    display: block;
    margin-bottom: .625em;
  }
  
  table td {
    border-bottom: 1px solid #ddd;
    display: block;
    font-size: .8em;
    text-align: right;
  }
  
  table td::before {
    /*
    * aria-label has no advantage, it won't be read inside a table
    content: attr(aria-label);
    */
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
  }
  
  table td:last-child {
    border-bottom: 0;
  }
}














/* general styling */
body {
  font-family: "Open Sans", sans-serif;
  line-height: 1.25;
}
</style>
<table>
  <caption>Statement Summary</caption>
  <thead>
    <tr>
      <th scope="col">Account</th>
      <th scope="col">Due Date</th>
      <th scope="col">Amount</th>
      <th scope="col">Period</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td data-label="Account">Visa - 3412</td>
      <td data-label="Due Date">04/01/2016</td>
      <td data-label="Amount">$1,190</td>
      <td data-label="Period">03/01/2016 - 03/31/2016</td>
    </tr>
    <tr>
      <td scope="row" data-label="Account">Visa - 6076</td>
      <td data-label="Due Date">03/01/2016</td>
      <td data-label="Amount">$2,443</td>
      <td data-label="Period">02/01/2016 - 02/29/2016</td>
    </tr>
    <tr>
      <td scope="row" data-label="Account">Corporate AMEX</td>
      <td data-label="Due Date">03/01/2016</td>
      <td data-label="Amount">$1,181</td>
      <td data-label="Period">02/01/2016 - 02/29/2016</td>
    </tr>
    <tr>
      <td scope="row" data-label="Acount">Visa - 3412</td>
      <td data-label="Due Date">02/01/2016</td>
      <td data-label="Amount">$842</td>
      <td data-label="Period">01/01/2016 - 01/31/2016</td>
    </tr>
  </tbody>
</table>

https://codepen.io/AllThingsSmitty/pen/MyqmdM