Reply To: Don't recommend this script

#516084
BOGDAN
Participant

    $posts = $em->getRepository(‘WebAdminBundle:SchedulePost’)->findBy([‘isPosted’ => false]);
    foreach ($posts as $post) {
    $date = $post->getPostDate()->format(‘U’);
    $url = $post->getUrl();
    if ($date <= date(‘U’)) {
    $nt = new \nxsAPI_GP();
    $loginError = $nt->connect(’email’, ‘pass’);
    if (!$loginError) {
    $nt->postGP($post->getTitle(), $url, ‘102714641469955361550’);
    }
    $em->remove($post);
    $em->flush();
    }
    }