› Forums › NextScripts API Forums – Google+, Pinterest, LinkedIn, etc.. › Don't recommend this script › Reply To: Don't recommend this script
October 13, 2016 at 8:15 am #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();
}
}