seregazhuk / php-pinterest-bot

This PHP library will help you to work with your Pinterest account without using any API account credentials.
MIT License
416 stars 129 forks source link

there is a problem when the run php script in CMD #464

Closed sonerss closed 5 years ago

sonerss commented 5 years ago

Hi, When I want to run a php script in cmd, there is a error. Error message is show below. "Parse error: syntax error, unexpected '?' in C:\wamp64\www\pinterest_3\vendor\seregazhuk\pinterest-bot\src\Api\Providers\User.php on line 180"

`<?php require_once("vendor/autoload.php");

// Start to develop here. Best regards https://php-download.com/ use seregazhuk\PinterestBot\Factories\PinterestBot;

$dosyalar = glob("./img/*.jpg"); $dosyalarCount = count($dosyalar);

$username = '--username--'; $password = '--password--'; $comment = '--comment--'; $etsy_link = '--link--';

// bot create $bot = PinterestBot::create();

// Login $result = $bot->auth->login($username,$password);

if ($bot->user->isBanned()) { echo "Account has been banned!\n"; die(); }

try { $random_num = rand(0,$dosyalarCount-1); $path = $dosyalar[$random_num];

if (!$result)
{
    echo $bot->getLastError();
    die();
}
else
{
    sleep(4);
    $boards = $bot->boards->forUser("--user--");
    $pinInfo = $bot->pins->create(
                                    $path,
                                    $boards[0]['id'],
                                    $comment,
                                    $etsy_link
                                 );
}

} catch(\Exception $e) { echo $e->getMessage(); } `

sonerss commented 5 years ago

I found the problem. I run it old PHP version. After change new PHP version, the problem solved