PHP retrive RSS feed from URL

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












I am trying to retrieve the latest RSS feed URL https://askubuntu.com/feeds using php scripting and while it works for every other url feed I use I do not see to be able to retrieve anything from askubuntu.com any advise why that is?



This is my php script MINUS credentials :-)



<?php

$conn = new mysqli($host, $username, $password, $dbname);
if ($conn->connect_error)
die("Connection failed: " . $conn->connect_error);


$newsoutput = new SimpleXMLElement($rss, LIBXML_NOCDATA, true);
$newsoutput = json_decode(json_encode($newsoutput), TRUE);

foreach ($newsoutput['channel']['item'] as $item)
$link = $conn->real_escape_string($item['link']);
$title = $conn->real_escape_string($item['title']);
$summary = $conn->real_escape_string($item['description']);

if( isset( $item['pubDate'] ) )
$listed = $conn->real_escape_string($item['pubDate']);
else
$listed = date('Y-m-d H:i:s');



$construct = "SELECT * FROM SEARCH_NEWS WHERE subject = '$title'";
$result = $conn->query($construct);

if ($result->num_rows > 0 )
else
$insert_sql = "INSERT INTO SEARCH_NEWS (link, subject, summary, listed)
VALUES ('$link', '$title', '$summary', '$listed')";

if ($conn->query($insert_sql) === TRUE)
else
echo "Error: " . $insert_sql . "n" . $conn->error;


$count++;
if($count==$max) break;

echo "Completed - $rssn";
?>


As I mentioned it works fine with other URLs example...



https://insights.ubuntu.com/feed



I really appreciate any help.



Many Thanks










share|improve this question

























    up vote
    0
    down vote

    favorite












    I am trying to retrieve the latest RSS feed URL https://askubuntu.com/feeds using php scripting and while it works for every other url feed I use I do not see to be able to retrieve anything from askubuntu.com any advise why that is?



    This is my php script MINUS credentials :-)



    <?php

    $conn = new mysqli($host, $username, $password, $dbname);
    if ($conn->connect_error)
    die("Connection failed: " . $conn->connect_error);


    $newsoutput = new SimpleXMLElement($rss, LIBXML_NOCDATA, true);
    $newsoutput = json_decode(json_encode($newsoutput), TRUE);

    foreach ($newsoutput['channel']['item'] as $item)
    $link = $conn->real_escape_string($item['link']);
    $title = $conn->real_escape_string($item['title']);
    $summary = $conn->real_escape_string($item['description']);

    if( isset( $item['pubDate'] ) )
    $listed = $conn->real_escape_string($item['pubDate']);
    else
    $listed = date('Y-m-d H:i:s');



    $construct = "SELECT * FROM SEARCH_NEWS WHERE subject = '$title'";
    $result = $conn->query($construct);

    if ($result->num_rows > 0 )
    else
    $insert_sql = "INSERT INTO SEARCH_NEWS (link, subject, summary, listed)
    VALUES ('$link', '$title', '$summary', '$listed')";

    if ($conn->query($insert_sql) === TRUE)
    else
    echo "Error: " . $insert_sql . "n" . $conn->error;


    $count++;
    if($count==$max) break;

    echo "Completed - $rssn";
    ?>


    As I mentioned it works fine with other URLs example...



    https://insights.ubuntu.com/feed



    I really appreciate any help.



    Many Thanks










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am trying to retrieve the latest RSS feed URL https://askubuntu.com/feeds using php scripting and while it works for every other url feed I use I do not see to be able to retrieve anything from askubuntu.com any advise why that is?



      This is my php script MINUS credentials :-)



      <?php

      $conn = new mysqli($host, $username, $password, $dbname);
      if ($conn->connect_error)
      die("Connection failed: " . $conn->connect_error);


      $newsoutput = new SimpleXMLElement($rss, LIBXML_NOCDATA, true);
      $newsoutput = json_decode(json_encode($newsoutput), TRUE);

      foreach ($newsoutput['channel']['item'] as $item)
      $link = $conn->real_escape_string($item['link']);
      $title = $conn->real_escape_string($item['title']);
      $summary = $conn->real_escape_string($item['description']);

      if( isset( $item['pubDate'] ) )
      $listed = $conn->real_escape_string($item['pubDate']);
      else
      $listed = date('Y-m-d H:i:s');



      $construct = "SELECT * FROM SEARCH_NEWS WHERE subject = '$title'";
      $result = $conn->query($construct);

      if ($result->num_rows > 0 )
      else
      $insert_sql = "INSERT INTO SEARCH_NEWS (link, subject, summary, listed)
      VALUES ('$link', '$title', '$summary', '$listed')";

      if ($conn->query($insert_sql) === TRUE)
      else
      echo "Error: " . $insert_sql . "n" . $conn->error;


      $count++;
      if($count==$max) break;

      echo "Completed - $rssn";
      ?>


      As I mentioned it works fine with other URLs example...



      https://insights.ubuntu.com/feed



      I really appreciate any help.



      Many Thanks










      share|improve this question













      I am trying to retrieve the latest RSS feed URL https://askubuntu.com/feeds using php scripting and while it works for every other url feed I use I do not see to be able to retrieve anything from askubuntu.com any advise why that is?



      This is my php script MINUS credentials :-)



      <?php

      $conn = new mysqli($host, $username, $password, $dbname);
      if ($conn->connect_error)
      die("Connection failed: " . $conn->connect_error);


      $newsoutput = new SimpleXMLElement($rss, LIBXML_NOCDATA, true);
      $newsoutput = json_decode(json_encode($newsoutput), TRUE);

      foreach ($newsoutput['channel']['item'] as $item)
      $link = $conn->real_escape_string($item['link']);
      $title = $conn->real_escape_string($item['title']);
      $summary = $conn->real_escape_string($item['description']);

      if( isset( $item['pubDate'] ) )
      $listed = $conn->real_escape_string($item['pubDate']);
      else
      $listed = date('Y-m-d H:i:s');



      $construct = "SELECT * FROM SEARCH_NEWS WHERE subject = '$title'";
      $result = $conn->query($construct);

      if ($result->num_rows > 0 )
      else
      $insert_sql = "INSERT INTO SEARCH_NEWS (link, subject, summary, listed)
      VALUES ('$link', '$title', '$summary', '$listed')";

      if ($conn->query($insert_sql) === TRUE)
      else
      echo "Error: " . $insert_sql . "n" . $conn->error;


      $count++;
      if($count==$max) break;

      echo "Completed - $rssn";
      ?>


      As I mentioned it works fine with other URLs example...



      https://insights.ubuntu.com/feed



      I really appreciate any help.



      Many Thanks







      apache2 php






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 29 at 17:32









      gcclinux

      909




      909

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1001068%2fphp-retrive-rss-feed-from-url%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1001068%2fphp-retrive-rss-feed-from-url%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Trouble downloading packages list due to a “Hash sum mismatch” error

          How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

          Cutting all the characters after the last /