我正在使用PinterestPinner创建一个脚本,可以登录一次并发布多个pin,而不是每次我想发布pin时都登录。
这就是我使用它的方式:
foreach ($links as $link)
{
$pinterest = new PinterestPinner($username, $password);
$result = $pinterest->pin(array(
'board' => $boardId,
'image' => $image,
'description' => $description,
'link' => $url,
));
if (false === $result) {
echo 'Error: ' . $pinterest->getError();
} else {
echo 'Pin Created, ID: ' . $pinterest->getPinID();
}
}
我认为通过这种方式使用它可以让脚本登录到Pinterest的每一个引脚。例如,如果我想在一次脚本运行中发布3个引脚,那么它会登录3次,而不是一次登录。(如果我说错了,请告诉我)。
在我的电路板上发布多个管脚时,如何修改脚本以保持登录会话处于活动状态?
发布于 2015-05-19 06:08:27
使用这个
try {
$pinterest = new PinterestPinner\Pinner;
$pin_id = $pinterest->setLogin('Your Pinterest Login')
->setPassword('Your Pinterest Password')
->setBoardID('Pinterest Board ID')
->setImage('Image URL')
->setDescription('Pin Description')
->setLink('Pin Link')
->pin();
} catch (PinterestPinner\PinnerException $e) {
echo $e->getMessage();
}
https://stackoverflow.com/questions/28212730
复制相似问题