PHP retrive RSS feed from URL

Clash 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
apache2 php
add a comment |Â
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
apache2 php
add a comment |Â
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
apache2 php
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
apache2 php
asked Jan 29 at 17:32
gcclinux
909
909
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password