Search code examples
phpstringpushbullet

Pushbullet PHP Api Lists


I'm using Pushbullet PHP API (link below) and want to push a list. Unfortunately I hear that pushing lists (and addresses) is deprecated.

https://github.com/ivkos/Pushbullet-for-PHP

Now I want to push my list as a string with note function, with line break after each item.

Someone knows how it works or knows a library where it is still working (or how to do it with curl)?

// $items = [] <- before;
$items = "";

for ($i = 0; $i < n; $i++) {
    // how i did it before
    //array_push($items, 'item i');
    // how can I do line break after the item, I tryed \n and %0A
    $items .= 'item i';
}

// doesn't work anymore
// $pushbullet->allDevices()->pushList( 'Title', $items );

$pushbullet
    ->allDevices()
    ->pushNote('Title', $items);

Solution

  • use " instead ' if you want to use \n. better yet using PHP_EOL

    $items .= 'item 1' . PHP_EOL;