There is another nice way.
You can pass a second value to the simple xml constructor which is a class
name to be used instead of SimpleXMLElement.
You can write your own class that extends SimpleXMLElement and override the
magic methods to skip the casting
Simon Schick
On 2/22/2012 8:32 AM, ma...@behnke.biz wrote:
There is another nice way.
You can pass a second value to the simple xml constructor which is a class
name to be used instead of SimpleXMLElement.
You can write your own class that extends SimpleXMLElement and override the
magic methods to skip the
Am 22.02.12 16:04, schrieb Jay Blanchard:
On 2/22/2012 8:32 AM, ma...@behnke.biz wrote:
There is another nice way.
You can pass a second value to the simple xml constructor which is a
class
name to be used instead of SimpleXMLElement.
You can write your own class that extends
I don't really see a need to add an extra layer or class extension
when casting works fine. Am I wrong? Why add several lines of code in
an extension class?
To keep the code readable?
$value = $xml-node;
vs.
$value = (String)$xml-node;
I like the first one. Plus you handle it to
Hi, Jay
If you're not using the variable *$xmlCompany* somewhere else I'd try to
skip the array and just do it with this single line:
*$arrayLead[0]-Company = (string)
$xml-SignonRq-SignonTransport-CustId-SPName;*
The result should not differ from what you have now.
Bye
Simon
2012/2/21 Jay
Howdy,
My PHP chops are a little rough around the edges so I know that I am missing
something. I am working with SimpleXML to retrieve values from an XML file like
this -
$xmlCompany = $xml-SignonRq-SignonTransport-CustId-SPName;
If I echo $xmlCompany I get the proper information.
If I use
Hi,
Using following code does not parse the xml:id attribute. If I change the
attribute's namespace to anything other than xml ( e.g. new:id ) then it
works.
$string = XML
TEI xml:id=decten1tlsg01
teiHeader
profileDesc
particDesc
person xml:id=interviewerTlsg01 /person
/particDesc
Hi,
Using following code does not parse the xml:id attribute. If I change the
attribute's namespace to anything other than xml ( e.g. new:id ) then it
works.
$string = XML
TEI xml:id=decten1tlsg01
teiHeader
profileDesc
particDesc
person xml:id=interviewerTlsg01 /person
/particDesc
I am kind of jacked here. I have a SimpleXML object that's been converted to an
array. In one of the nodes, for no reason I can see, the array is populated
differently if there is only one order_item than if there are multiple
order_items.
If there is just one, my $order_item array looks like
On Tue, Sep 28, 2010 at 4:29 PM, Brian Dunning br...@briandunning.comwrote:
I am kind of jacked here. I have a SimpleXML object that's been converted
to an array.
how was the SimpleXMLElement converted to an array?
-nathan
If you read down to the bottom of the post, the function I used is given.
On Sep 28, 2010, at 3:47 PM, Nathan Nobbe wrote:
On Tue, Sep 28, 2010 at 4:29 PM, Brian Dunning br...@briandunning.com wrote:
I am kind of jacked here. I have a SimpleXML object that's been converted to
an array.
On Tue, Sep 28, 2010 at 5:06 PM, Brian Dunning br...@briandunning.comwrote:
If you read down to the bottom of the post, the function I used is given.
My apologies for the hasty response. well, if i had to guess, id say thats
where the problem is. why cant you just iterate over the object w/
Hello all,
I'm struggling here, but no joy so far.
Having this XML file that I'm loading using simplexml_load_file():
http://pastebin.com/JiW3LxWM
I need to add some domain:create children nodes after line 8.
What do I need to add?
This:
http://pastebin.com/mT27g3ZN
In order to do so, I have
I was able to resolve this by changing the XML file encoding from UTF-8 to
ISO-8859-1. Works like a charm now, with the XML-encoded characters.
Thanks to all who offered their help.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I think that should be amp; because you cant use in xml as
independent alphbet
On 5/7/10, Dan Joseph dmjos...@gmail.com wrote:
On Thu, May 6, 2010 at 8:02 PM, Brian Dunning br...@briandunning.comwrote:
Hey all -
I'm using simplexml-load-string just to validation a string of XML, and
- amp; added space because browser is converting it to :)
On 5/8/10, Deva devendra...@gmail.com wrote:
I think that should be amp; because you cant use in xml as
independent alphbet
On 5/7/10, Dan Joseph dmjos...@gmail.com wrote:
On Thu, May 6, 2010 at 8:02 PM, Brian Dunning
On 8 May 2010 00:39, Nathan Nobbe quickshif...@gmail.com wrote:
hmm, both the strings seem to work fine on my laptop:
+1. Have no problem with either string
--
hype
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
This time simplexml-load-string also gave me the same error on the following
line:
first_nameCharlie amp; Brady/first_name
Can anyone confirm whether simplexml-load-string will or will not accept or
allow XML-encoded characters? It seems that it should and would be pretty
surprising if it
On Fri, May 7, 2010 at 4:32 PM, Brian Dunning br...@briandunning.comwrote:
This time simplexml-load-string also gave me the same error on the
following line:
first_nameCharlie amp; Brady/first_name
Can anyone confirm whether simplexml-load-string will or will not accept or
allow
Hey all -
I'm using simplexml-load-string just to validation a string of XML, and
libxml-get-errors to return any errors. It's always worked before, but today
it's choking on this line in the XML:
client_orderitem_numberBasketball Personalized Notebook -
Jeffapos;s/client_orderitem_number
On Thu, May 6, 2010 at 8:02 PM, Brian Dunning br...@briandunning.comwrote:
Hey all -
I'm using simplexml-load-string just to validation a string of XML, and
libxml-get-errors to return any errors. It's always worked before, but today
it's choking on this line in the XML:
Hello, I want to convert some xml stuff to simple string using php, say:
?php
$string = XML
a left foocenter1okok/okcenter2/fooright /a
XML;
$xml = simplexml_load_string($string);
echo $xml;
?
The code will output left right while all the central stuff was lost.
How should I print it as left
On Sun, 2010-03-14 at 21:58 +0800, Dasn wrote:
Hello, I want to convert some xml stuff to simple string using php, say:
?php
$string = XML
a left foocenter1okok/okcenter2/fooright /a
XML;
$xml = simplexml_load_string($string);
echo $xml;
?
The code will output left right while all
On Sun, 14 Mar 2010 22:02:22 +0800, Ashley Sheridan wrote:
On Sun, 2010-03-14 at 21:58 +0800, Dasn wrote:
Hello, I want to convert some xml stuff to simple string using php, say:
?php
$string = XML
a left foocenter1okok/okcenter2/fooright /a
XML;
$xml = simplexml_load_string($string);
echo
On Sun, 14 Mar 2010 22:02:22 +0800, Ashley Sheridan wrote:
On Sun, 2010-03-14 at 21:58 +0800, Dasn wrote:
Hello, I want to convert some xml stuff to simple string using php, say:
?php
$string = XML
a left foocenter1okok/okcenter2/fooright /a
XML;
$xml = simplexml_load_string($string);
echo
On Sun, 2010-02-07 at 23:24 -0800, TerryA wrote:
Hi Carlos
I looked at the documentation for hours but don't see any solution. I'm
uploading a sample file here. The full file contains around 100 properties
but the uploaded file has just one. I need to extract data from this file to
write
Hi Guys
Thanks for all your input. This forum is great! I can get the attributes OK
but I can't code the checking routing correctly. This is what I have:
Many thanks again for your input. I tried this but it only gives me the data
for each element. I need to be able to access the attributes of
Got it! I corrected my syntax and this code now works as far as I can tell:
?php
$file= 'annnonces.xml';
// load file
$xml = simplexml_load_file($file) or die (Unable to load XML file!);
foreach ($xml-xpath('//lot') as $lot) {
echo $lot-numero_lot, 'type ', $lot-type, $lot-identification,
Hi Shawn
Thanks for answering my query. I have looked at the suggestions:
$xml = simplexml_load_file('file.xml', 'SimpleXMLElement', LIBXML_NOCDATA);
I am/was able to load the file OK and to access the data by iteration.
However, I can't find a way to extract data by attributes. I need
TerryA schrieb:
Hi Shawn
Thanks for answering my query. I have looked at the suggestions:
$xml = simplexml_load_file('file.xml', 'SimpleXMLElement', LIBXML_NOCDATA);
I am/was able to load the file OK and to access the data by iteration.
However, I can't find a way to extract data by
Hi Carlos
I looked at the documentation for hours but don't see any solution. I'm
uploading a sample file here. The full file contains around 100 properties
but the uploaded file has just one. I need to extract data from this file to
write to a MySQL database. I have no problem in doing this
TerryA wrote:
My first post and I'm just a few days into learning PHP so that I can extract
data from an XML feed for updating a MySQL driven website. Simplexml grabs
most of my data without a problem but I can't get at the data in elements
such as:
element idtype=11 lang=fr
Hello All,
I have an XML document that has elements as such:
Query:Expression
Query:ResourceID
Query:EqualTest/Query:Equal
/Query:ResourceID
/Query:Expression
I cannot figure out how to access these with simple xml. I am not opposed
to a
Hi,
It seems that var_dump() of a SimpleXMLElement does not show an
attribute of elements that contain text content?
I hope my examples might show what I mean:
$xml = 'root rootattr=root valueinner attr=value//root';
$simple = new SimpleXMLElement($xml);
var_dump($simple);
echo
Could you help me clarify one thing that I don't understand... let's
put it simple, just imagine that I have a tiny XML document with a
list of movies:
movies
title
iGone/i with bthe/b wind
/title
/movies
I want to read this XML file and write the name of the
Hi,
is there any way how to set output encoding for SimpleXML?
It will load XML document in any encoding, but internally, it converts the
document to UTF-8 and outputs it in this encoding.
I would like to have output encoding set to ISO-8859-2, is it possible?
thanks.
--
Ondrej Kulaty
--
At 2:40 PM +0200 5/5/09, Ondrej Kulaty wrote:
Hi,
is there any way how to set output encoding for SimpleXML?
It will load XML document in any encoding, but internally, it converts the
document to UTF-8 and outputs it in this encoding.
I would like to have output encoding set to ISO-8859-2, is it
Because i am working on an old system which is in ISO, i cant use unicode.
--
Ondrej Kulaty
tedd tedd.sperl...@gmail.com píse v diskusním príspevku
news:p06240802c625f6b4e...@[192.168.1.101]...
At 2:40 PM +0200 5/5/09, Ondrej Kulaty wrote:
Hi,
is there any way how to set output encoding for
On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote:
I have bean trying to right a PHP script to generate XHTML code from
the
class documentation xml files created by Doxygen(the HTML it outputs
is
invalid, messy and virtually imposable to integrate into another web
page). One thing
I HAVE THE SAME PROBLEM, PLEASE HOW HAVE YOU DONE IT
On Sun, Apr 5, 2009 at 4:08 PM, hessi...@hessiess.com wrote:
On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote:
I have bean trying to right a PHP script to generate XHTML code from
the
class documentation xml files created by
I HAVE THE SAME PROBLEM, PLEASE HOW HAVE YOU DONE IT
On Sun, Apr 5, 2009 at 4:08 PM, hessi...@hessiess.com wrote:
On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote:
I have bean trying to right a PHP script to generate XHTML code from
the
class documentation xml files created
I have bean trying to right a PHP script to generate XHTML code from the
class documentation xml files created by Doxygen(the HTML it outputs is
invalid, messy and virtually imposable to integrate into another web
page). One thing has bean causing problems, the tags which start with `@',
for
On Apr 3, 2009, at 17:52, hessi...@hessiess.com wrote:
I have bean trying to right a PHP script to generate XHTML code from
the
class documentation xml files created by Doxygen(the HTML it outputs
is
invalid, messy and virtually imposable to integrate into another web
page). One thing has
Hi,
I am trying to write a PHP interface to ISBNdb.com. When I make a certain
request, the following is returned
ISBNdb server_time=2009-02-24T18:57:31Z
BookList total_results=1 page_size=10 page_number=1
shown_results=1
BookData book_id=language_proof_and_logic isbn=157586374X
Hi,
I have a basic XML document that I am grabbing with simplexml_load_string(),
here is the print_r:
SimpleXMLElement Object
(
[Package] = SimpleXMLElement Object
(
[PackageID] = 804
[PackageName] = Silver
[BandwidthGB] = 20
Tim-Hinnerk Heuer
http://www.ihostnz.com
On Fri, Dec 19, 2008 at 3:50 PM, Dan Joseph dmjos...@gmail.com wrote:
Hi,
I have a basic XML document that I am grabbing with
simplexml_load_string(),
here is the print_r:
SimpleXMLElement Object
(
[Package] = SimpleXMLElement Object
On Thu, Dec 18, 2008 at 10:01 PM, German Geek geek...@gmail.com wrote:
$val = (string) $x-Package-PackageID;
or
$val = (int) $x-Package-PackageID;
Ha... I would have never figured that out... Thank you to you both! That
did the trick.
--
-Dan Joseph
www.canishosting.com - Plans start @
Hi All,
I am using PHP's senderxml library to generate the xml. My problem is that
xml generated by this library encode some characters like , etc. Since i
have to give the output xml to the device so i don't want to encode these
characters.
I know there is html_entity_decode method which can
Do you know any reason why the following code does work
$xmlOperazioni = simplexml_load_file($xmlFilename);
foreach($xmlOperazioni-operazione as $operazione) {
if($operazione['nome'] == $operazioneRichiesta) {
require($operazione['php']);
break;
}
}
but the following does not
2008/9/9 Mirco Soderi [EMAIL PROTECTED]
Do you know any reason why the following code does work
$xmlOperazioni = simplexml_load_file($xmlFilename);
foreach($xmlOperazioni-operazione as $operazione) {
if($operazione['nome'] == $operazioneRichiesta) {
require($operazione['php']);
Hi
I'm using simplexml to create some xml files.
Here's a stripped example, how can I get this to work? Tried millions
different ways still no joy.
?php
header(Content-type: text/xml);
$xml = simplexml_load_string('root/root');
$root = $xml-addChild('tests');
You have to handle the html special chars.
== amp;
On Thu, Jul 10, 2008 at 10:59 AM, Joakim Ling [EMAIL PROTECTED] wrote:
Hi
I'm using simplexml to create some xml files.
Here's a stripped example, how can I get this to work? Tried millions
different ways still no joy.
?php
You have to handle the html special chars.
== amp;
On Thu, Jul 10, 2008 at 10:59 AM, Joakim Ling [EMAIL PROTECTED] wrote:
Hi
I'm using simplexml to create some xml files.
Here's a stripped example, how can I get this to work? Tried millions
different ways still no joy.
?php
On Thu, Jul 10, 2008 at 10:55 AM, Nate Tallman
[EMAIL PROTECTED] wrote:
You have to handle the html special chars.
== amp;
and if you use the SimpleXMLElement constructor, it will throw an exception,
rather than just return false, which is useful, because it tells you what
went wrong.
Hi,
I am having problems with the below test case. I am using an extended
googlebase Atom format to store my data. Included in the test case is
a simplified version of my XML-document.
PROBLEM:
Why do I need to re-register namespace 'a' when using xpath through
the result of a previous
On Jan 18, 2008 12:04 PM, Carole E. Mah [EMAIL PROTECTED] wrote:
I did exactly this, and still got:
?xml version=1.0 encoding=UTF-8?
rss xmlns:itunes=http://www.itunes.com/dtds/podcast-1.0.dtd; version=
2.0
channel
!-- snipping, some elements omitted ... --
On Jan 18, 2008 12:22 PM, Nathan Nobbe [EMAIL PROTECTED] wrote:
Are you trying to read an existing document into a SimpleXMLElement, or are
you trying to create a SimpleXMLElement instance and generate a document
from that?
My impression was you were trying to do the later; please clarify and
based upon information from bug #43221, if you define the namespace
beforehand
it will work.
?php
$xml = new SimpleXMLElement('root xmlns:itunes=http://apple.com/');
$n = $xml-addChild(subtitle, Musical Mockery, http://apple.com;);
print_r($xml-asXml());
?
produces:
?xml version=1.0?
root
On Jan 18, 2008 2:48 PM, Carole E. Mah [EMAIL PROTECTED] wrote:
On Jan 18, 2008 12:22 PM, Nathan Nobbe [EMAIL PROTECTED] wrote:
Are you trying to read an existing document into a SimpleXMLElement, or
are
you trying to create a SimpleXMLElement instance and generate a document
from that?
On Jan 14, 2008 11:21 PM, Carole E. Mah [EMAIL PROTECTED] wrote:
Yes, I tried the following:
http://us3.php.net/manual/en/function.dom-domdocument-createelementns.php
Same results.
based upon information from bug #43221, if you define the namespace
beforehand
it will work.
?php
$xml =
On Tue, January 15, 2008 12:34 am, Naz Gassiep wrote:
What's the current status on this bug:
http://bugs.php.net/bug.php?id=39164
Regardless of what the PHP developers say in those comments, the
modification of data when it is read is not correct. If it is intended
behavior, then the
This is problematic code, even though it works, because it
auto-generates an unnecessary xmlns: attribute:
$item-addChild('itunes:subtitle', $mySubTitle,itunes);
It generates the following XML:
itunes:subtitle xmlns:itunes=itunesMusical Mockery/itunes:subtitle
When really all we want is this:
On Jan 14, 2008 10:22 PM, Carole E. Mah [EMAIL PROTECTED] wrote:
This is problematic code, even though it works, because it
auto-generates an unnecessary xmlns: attribute:
$item-addChild('itunes:subtitle', $mySubTitle,itunes);
It generates the following XML:
itunes:subtitle
Yes, I tried the following:
http://us3.php.net/manual/en/function.dom-domdocument-createelementns.php
Same results.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
What's the current status on this bug:
http://bugs.php.net/bug.php?id=39164
Regardless of what the PHP developers say in those comments, the
modification of data when it is read is not correct. If it is intended
behavior, then the developer/s who intend it to be that way are wrong.
Under no
Hi all!
I'm using simplexml to load an xml into an object.
The XML is this:
?xml version=1.0?
request
customerID3/customerID
appNameagenda/appName
ticketTypecticket_agenda_server/ticketType
ticketTypeID1/ticketTypeID
platformID1/platformID
ticketActionaddUsersToGroup/ticketAction
/request
On Dec 31, 2007 7:11 AM, Dani Castaños [EMAIL PROTECTED] wrote:
Hi all!
I'm using simplexml to load an xml into an object.
The XML is this:
?xml version=1.0?
request
customerID3/customerID
appNameagenda/appName
ticketTypecticket_agenda_server/ticketType
ticketTypeID1/ticketTypeID
Nathan Nobbe escribió:
On Dec 31, 2007 7:11 AM, Dani Castaños [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
Hi all!
I'm using simplexml to load an xml into an object.
The XML is this:
?xml version=1.0?
request
customerID3/customerID
appNameagenda/appName
On Dec 31, 2007 10:09 AM, Dani Castaños [EMAIL PROTECTED] wrote:
Thanks! Problem fixed... But I think PHP must do the cast automatically.
I think it's a bug fixed in a further version than mine as I've read
no problem; but just fyi, its not a bug; the behavior is as expected per the
manual:
Hey all,
I have some XML files I need to parse and then
display (they have HTML formatting in them as well).
They contain the following:
?xml version=1.0 ?
!DOCTYPE html PUBLIC -//Gale//DTD Gale eBook
Document DTD 20031113//EN galeeBkdoc.dtd
html gale:versionNumber=OEB 1.2, Gale 1.3
head
I'm not sure, but try casting $xml-title to string, like this:
$title = (string) $xml-title;
On Nov 26, 2007, at 1:44 PM, Skip Evans [EMAIL PROTECTED] wrote:
Hey all,
I have some XML files I need to parse and then display (they have
HTML formatting in them as well).
They contain the
line)
How can i solve that or determine when there are no more tags to parse.
JM Guillermin [EMAIL PROTECTED] wrote:
And with :
foreach ($xml as $cs) {
.
}
??
jm
- Original Message -
From: Don Don
To: PHP List
Sent: Thursday, April 05, 2007 10:32 AM
Subject: [PHP
I am using simple xml to parse an xml file, the program parses the file and
produces an error at the end of the foreach loop when it reaches the end of the
tag, it tries to look for an element/tag when there is none and produces an
error Call to a member function attributes() on a non-object
And with :
foreach ($xml as $cs) {
.
}
??
jm
- Original Message -
From: Don Don [EMAIL PROTECTED]
To: PHP List php-general@lists.php.net
Sent: Thursday, April 05, 2007 10:32 AM
Subject: [PHP] SimpleXML end of element/tag error
I am using simple xml to parse an xml file
Hi there. I'm hoping someone can help me with what I think might be a
slightly obscure problem.
I'm trying to get the SimpleXML extension to read an XML file and
process the XInclude statements within the XML file.
The SimpleXML docs state that libxml options may be specified using the
I've recently upgraded to PHP 5.1.4 from 5.1.2 and noticed that in 5.1.3
there were changes made to SimpleXML. Now, when I touch an element
which didn't used to exist, instead of acting like it didn't exist, it
creates it! That's horrible!
Well, this used to work:
?php
$xmlstr =
On Sat, April 29, 2006 8:30 pm, Anthony Ettinger wrote:
Warning: var_dump() [function.var-dump]: Node no longer exists in
Foo.php on line 78
object(SimpleXMLElement)#86 (0) { } [title]=
I turn an xml string into a simplexml object, and then ran serialize()
on it before caching the output
Richard Lynch wrote:
On Sat, April 29, 2006 8:30 pm, Anthony Ettinger wrote:
Warning: var_dump() [function.var-dump]: Node no longer exists in
Foo.php on line 78
object(SimpleXMLElement)#86 (0) { } [title]=
I turn an xml string into a simplexml object, and then ran serialize()
on it before
Warning: var_dump() [function.var-dump]: Node no longer exists in
Foo.php on line 78
object(SimpleXMLElement)#86 (0) { } [title]=
I turn an xml string into a simplexml object, and then ran serialize()
on it before caching the output locally. When I read it back in and
run unserialize() to do a
Just replying to my original post as means of a follow up. I have gone ahead
and used Rasmus' code, he was correct in surmising I was only worried about
an overloaded and slow responding site. It would be very atypical for the
site to be down completely.
While the cache code was very
Here is an example Wez wrote years ago:
-snip code -
Years ago?
stream_socket_client() is php5.
How long ago did php5 launch?
tedd
--
http://sperling.com
--
PHP General Mailing List (http://www.php.net/)
To
tedd wrote:
Here is an example Wez wrote years ago:
-snip code -
Years ago?
stream_socket_client() is php5.
How long ago did php5 launch?
The first beta was in June 2003. But the streams code was written well
before that.
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To
At 10:31 AM -0700 4/11/06, Rasmus Lerdorf wrote:
tedd wrote:
Here is an example Wez wrote years ago:
-snip code -
Years ago?
stream_socket_client() is php5.
How long ago did php5 launch?
The first beta was in June 2003. But the streams code was written
well before that.
-Rasmus
I'm
On Mon, April 10, 2006 10:21 pm, Robert Cummings wrote:
On Mon, 2006-04-10 at 23:11, Richard Lynch wrote:
On Mon, April 10, 2006 9:59 pm, Rasmus Lerdorf wrote:
Richard Lynch wrote:
I've added a Note to 'fopen' so maybe others won't completely miss
this feature and look as foolish as I do
On Mon, April 10, 2006 10:24 pm, Rasmus Lerdorf wrote:
You could volunteer to help maintain the user notes.
I've just spent five/ten minutes with Google and php.net trying to
find the best way to volunteer to do just that...
Admittedly not a LOT of effort, but...
Where do I start?
I do have
Richard Lynch wrote:
On Mon, April 10, 2006 10:24 pm, Rasmus Lerdorf wrote:
You could volunteer to help maintain the user notes.
I've just spent five/ten minutes with Google and php.net trying to
find the best way to volunteer to do just that...
Admittedly not a LOT of effort, but...
Where
Hello all,
My website uses simpleXML to print the headlines from a few different RSS
feeds. The problem is that sometimes the remote feed is unavailable if there
are problems with the remote site, and the result is that I must wait for 30
seconds or so until the HTTP timeout occurs, delaying
On Mon, 2006-04-10 at 15:25, darren kirby wrote:
Hello all,
My website uses simpleXML to print the headlines from a few different RSS
feeds. The problem is that sometimes the remote feed is unavailable if there
are problems with the remote site, and the result is that I must wait for 30
quoth the Robert Cummings:
Why do you do this on every request? Why not have a cron job retrieve an
update every 20 minutes or whatnot and stuff it into a database table
for your page to access? Then if the cron fails to retrieve the feed it
can just leave the table as is, and your visitors
On Mon, 2006-04-10 at 17:46, darren kirby wrote:
quoth the Robert Cummings:
Why do you do this on every request? Why not have a cron job retrieve an
update every 20 minutes or whatnot and stuff it into a database table
for your page to access? Then if the cron fails to retrieve the feed
quoth the Robert Cummings:
On Mon, 2006-04-10 at 17:46, darren kirby wrote:
quoth the Robert Cummings:
Why do you do this on every request? Why not have a cron job retrieve
an update every 20 minutes or whatnot and stuff it into a database
table for your page to access? Then if the
Maybe you can read the contents of the feeds using fsockopen() and
stream_set_timeout() to adjust the timeout, or stream_set_blocking()
to read it asynchronously, and then load the xml with
simplexml_load_string().
PS: I forgot to reply to all and mention you'll have to send the GET
http command
quoth the Martin Alterisio:
Maybe you can read the contents of the feeds using fsockopen() and
stream_set_timeout() to adjust the timeout, or stream_set_blocking()
to read it asynchronously, and then load the xml with
simplexml_load_string().
Hello, and thanks for the response,
As Robert
Martin Alterisio wrote:
Maybe you can read the contents of the feeds using fsockopen() and
stream_set_timeout() to adjust the timeout, or stream_set_blocking()
to read it asynchronously, and then load the xml with
simplexml_load_string().
PS: I forgot to reply to all and mention you'll have to
On Mon, April 10, 2006 4:46 pm, darren kirby wrote:
quoth the Robert Cummings:
Why do you do this on every request? Why not have a cron job
retrieve an
update every 20 minutes or whatnot and stuff it into a database
table
for your page to access? Then if the cron fails to retrieve the feed
On Mon, April 10, 2006 6:17 pm, Rasmus Lerdorf wrote:
Martin Alterisio wrote:
Maybe you can read the contents of the feeds using fsockopen() and
stream_set_timeout() to adjust the timeout, or stream_set_blocking()
to read it asynchronously, and then load the xml with
simplexml_load_string().
quoth the Richard Lynch:
Perhaps, then, you should:
maintain a list of URLs and acceptable age of feed.
Attempt to snag the new content upon visit, if the content is old
Show the old content if the feed takes longer than X seconds.
I really do like this idea, as I would rather use an old feed
On Mon, 2006-04-10 at 20:52, darren kirby wrote:
quoth the Richard Lynch:
Perhaps, then, you should:
maintain a list of URLs and acceptable age of feed.
Attempt to snag the new content upon visit, if the content is old
Show the old content if the feed takes longer than X seconds.
I
When I do get something figured out I will post results here. Problem
is, with
either method I need to find a feed that is slow to test with. If I
test it
with a bunk url it will just 404 immediately right? Is there a way to
simulate a slow connection?
I dunno about similating a slow
Maybe it's too late to say this, but if your real problem is that you
don't want the function reading
the rss feed to block the rest of your page, you can always put the
output of the reading of the feed
on a separate page, and include this through an iframe.
darren kirby wrote:
Hello all,
1 - 100 of 147 matches
Mail list logo