2015-01-29 3 views
3

나는 핀을 게시하고 싶을 때마다 로그인하지 않고 한 번 로그인하고 여러 개의 핀을 게시 할 수있는 스크립트를 만들기 위해 PinterestPinner을 사용하고 있습니다.Pinterest 게시판에 Autopost 다중 핀

이것은 내가 그것을 사용하고 어떻게 : 나는 그것을 사용하여 생각

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(); 
    } 
} 

이 방법은 모든 단일 핀 클립에 스크립트 로그인을합니다. 예를 들어, 단일 스크립트 실행에서 3 핀을 게시하려면 한 번 로그인하는 대신 3 번 로그인하십시오. (이 문제가 잘못되었다고 알려주십시오.)

게시판에 여러 개의 핀을 게시하는 동안 로그인 세션을 유지하기 위해 스크립트를 수정할 수 있습니까?

답변

1

사용이

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(); 
}