|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
The below xml is generated when I make a remote call like:
?php $url = "http://......./oai? verb=ListRecords&metadataPrefix=frida&set=UUI"; $input = @file_get_contents($url) or die('Could not access file: $url'); echo $input; ?> How can I extract only <resumptionToken completeListSize="14" cursor="0">set+UITO+cls +14+cursor+3+last+110547</resumptionToken> and put it in a variable? Thanks in advance. Ofuuzo ---------------------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> <responseDate>2008-02-14T12:41:33Z</responseDate> ..... ...... </record> <resumptionToken completeListSize="14" cursor="0">set+UITO+cls +14+cursor+3+last+110547</resumptionToken> </ListRecord> </OAI-PMH> |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Thu, 14 Feb 2008 12:54:07 +0100, <ofuuzo1@yahoo.no> wrote:
> The below xml is generated when I make a remote call like: > > ?php > $url = "http://......./oai? > verb=ListRecords&metadataPrefix=frida&set=UUI"; > $input = @file_get_contents($url) or die('Could not access file: > $url'); > echo $input; > ?> > How can I extract only > <resumptionToken completeListSize="14" cursor="0">set+UITO+cls > +14+cursor+3+last+110547</resumptionToken> > > and put it in a variable? > > Thanks in advance. > Ofuuzo > > ---------------------------------------------------------------------- > <?xml version="1.0" encoding="UTF-8"?> > <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > schemaLocation="http://www.openarchives.org/OAI/2.0/ > http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> > <responseDate>2008-02-14T12:41:33Z</responseDate> > ..... > ...... > </record> > <resumptionToken completeListSize="14" cursor="0">set+UITO+cls > +14+cursor+3+last+110547</resumptionToken> > </ListRecord> > </OAI-PMH> $xml = new DOMDocument(); $xml->load('http://........'); $node = $xml->getElementsByTagName('resummtiontoken')->item(0); $text = $node->nodeValue; $listsize = $node->getAttribute('completeListSize'); $cursor = $node->getAttribute('cursor'); -- Rik Wasmus |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On 14 Feb, 13:42, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 14 Feb 2008 12:54:07 +0100, <ofuu...@yahoo.no> wrote: > > The below xml is generated when I make a remote call like: > > > ?php > > $url = "http://......./oai? > > verb=ListRecords&metadataPrefix=frida&set=UUI"; > > $input = @file_get_contents($url) or die('Could not access file: > > $url'); > > echo $input; > > ?> > > How can I extract only > > <resumptionToken completeListSize="14" cursor="0">set+UITO+cls > > +14+cursor+3+last+110547</resumptionToken> > > > and put it in a variable? > > > Thanks in advance. > > Ofuuzo > > > ---------------------------------------------------------------------- > > <?xml version="1.0" encoding="UTF-8"?> > > <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > schemaLocation="http://www.openarchives.org/OAI/2.0/ > >http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> > > <responseDate>2008-02-14T12:41:33Z</responseDate> > > ..... > > ...... > > </record> > > <resumptionToken completeListSize="14" cursor="0">set+UITO+cls > > +14+cursor+3+last+110547</resumptionToken> > > </ListRecord> > > </OAI-PMH> > > $xml = new DOMDocument(); > $xml->load('http://........'); > $node = $xml->getElementsByTagName('resummtiontoken')->item(0); > $text = $node->nodeValue; > $listsize = $node->getAttribute('completeListSize'); > $cursor = $node->getAttribute('cursor'); > -- > Rik Wasmus It does not work for php4.x. - Ofuuzo |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Thu, 14 Feb 2008 14:07:15 +0100, <ofuuzo1@yahoo.no> wrote:
> On 14 Feb, 13:42, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote: >> On Thu, 14 Feb 2008 12:54:07 +0100, <ofuu...@yahoo.no> wrote: >> > The below xml is generated when I make a remote call like: >> >> > ?php >> > $url = "http://......./oai? >> > verb=ListRecords&metadataPrefix=frida&set=UUI"; >> > $input = @file_get_contents($url) or die('Could not access file: >> > $url'); >> > echo $input; >> > ?> >> > How can I extract only >> > <resumptionToken completeListSize="14" cursor="0">set+UITO+cls >> > +14+cursor+3+last+110547</resumptionToken> >> >> > and put it in a variable? >> >> > Thanks in advance. >> > Ofuuzo >> >> > ---------------------------------------------------------------------- >> > <?xml version="1.0" encoding="UTF-8"?> >> > <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> > schemaLocation="http://www.openarchives.org/OAI/2.0/ >> >http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> >> > <responseDate>2008-02-14T12:41:33Z</responseDate> >> > ..... >> > ...... >> > </record> >> > <resumptionToken completeListSize="14" cursor="0">set+UITO+cls >> > +14+cursor+3+last+110547</resumptionToken> >> > </ListRecord> >> > </OAI-PMH> >> >> $xml = new DOMDocument(); >> $xml->load('http://........'); >> $node = $xml->getElementsByTagName('resummtiontoken')->item(0); >> $text = $node->nodeValue; >> $listsize = $node->getAttribute('completeListSize'); >> $cursor = $node->getAttribute('cursor'); > > It does not work for php4.x. Then rewrite it using equivalent DomXml functions (http://nl2.php.net/domxml). Seriously consider upgrading though, PHP 4 is end of life... -- Rik Wasmus |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On 14 Feb, 14:12, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 14 Feb 2008 14:07:15 +0100, <ofuu...@yahoo.no> wrote: > > On 14 Feb, 13:42, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote: > >> On Thu, 14 Feb 2008 12:54:07 +0100, <ofuu...@yahoo.no> wrote: > >> > The below xml is generated when I make a remote call like: > > >> > ?php > >> > $url = "http://......./oai? > >> > verb=ListRecords&metadataPrefix=frida&set=UUI"; > >> > $input = @file_get_contents($url) or die('Could not access file: > >> > $url'); > >> > echo $input; > >> > ?> > >> > How can I extract only > >> > <resumptionToken completeListSize="14" cursor="0">set+UITO+cls > >> > +14+cursor+3+last+110547</resumptionToken> > > >> > and put it in a variable? > > >> > Thanks in advance. > >> > Ofuuzo > > >> > ---------------------------------------------------------------------- > >> > <?xml version="1.0" encoding="UTF-8"?> > >> > <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" > >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > >> > schemaLocation="http://www.openarchives.org/OAI/2.0/ > >> >http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> > >> > <responseDate>2008-02-14T12:41:33Z</responseDate> > >> > ..... > >> > ...... > >> > </record> > >> > <resumptionToken completeListSize="14" cursor="0">set+UITO+cls > >> > +14+cursor+3+last+110547</resumptionToken> > >> > </ListRecord> > >> > </OAI-PMH> > > >> $xml = new DOMDocument(); > >> $xml->load('http://........'); > >> $node = $xml->getElementsByTagName('resummtiontoken')->item(0); > >> $text = $node->nodeValue; > >> $listsize = $node->getAttribute('completeListSize'); > >> $cursor = $node->getAttribute('cursor'); > > > It does not work for php4.x. > > Then rewrite it using equivalent DomXml functions > (http://nl2.php.net/domxml). Seriously consider upgrading though, PHP 4 is > end of life... > -- > Rik Wasmus Thanks Ofuuzo |
|
![]() |
| Outils de la discussion | |
|
|