title: How can I get data from RSS by date in PHP?
body: <p>I am working on a small script where I wanna take only my website's latest post which is posted yesterday mean I wanna get all yesterday's links and titles.
  I tried with my script but I am getting all URLs I am not sure how can I fix it.</p>
  <p>Can anyone help me solve this problem?</p>
  <p>I was wondering if I can use 'where' attribute like we usually use in SQL. I want only 1 days posts to be scraped.</p>
  <pre><code>&lt;?php
  header('Content-Type: application/json');
  $url = &quot;https://www.lifegoals.co.in/feed/&quot;;
  $i=0;
   $invalidurl = false;
   if(@simplexml_load_file($url)){
    $feeds = simplexml_load_file($url);
   }else{
    $invalidurl = true;
    echo &quot;&lt;h2&gt;Invalid RSS feed URL.&lt;/h2&gt;&quot;;
   }
   if(!empty($feeds)){
  
    //$site = $feeds-&gt;channel-&gt;title;
    //$sitelink = $feeds-&gt;channel-&gt;link;
  
    //echo &quot;&lt;h1&gt;&quot;.$site.&quot;&lt;/h1&gt;&quot;;
    foreach ($feeds-&gt;channel-&gt;item as $item) {
  
     $title = $item-&gt;title;
     $link = $item-&gt;link;
     //$description = $item-&gt;description;
     $postDate = $item-&gt;pubDate;
     $pubDate = date('D, d M Y',strtotime($postDate));
     $currDate = date('D, d M Y');
     if($i&gt;=10) break;   
     if($pubDate=$currDate){
     $rss =   &quot;&lt;item&gt;
                  &lt;title&gt;$title&lt;/title&gt;
                  &lt;link&gt;$link&lt;/link&gt;
              &lt;/item&gt;&quot;;     
              
     echo $rss;   
     $i++;
     }
    } 
    }
  ?&gt;
  </code></pre>
  <p><strong>i want only 1 days posts there are 4 days posts</strong></p>