Questions tagged [simplexml]

A PHP extension shipped with the main source tree. The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators. For the Java "Simple" XML framework, please use the [simple-framework] tag.

The SimpleXML extension provides a simple toolset to convert XML to an object that can be processed with normal property selectors and array iterators.

Once an XML document is converted, the object obtained will reference the root element of the document. The object's properties will reflect the child nodes and uses the same name as the nodes. This principle works recursively across the document.

3932 questions
1
vote
0 answers

PHP : XML Parsing Error - simplexml_load_string() expects parameter 1 to be string

I am trying to parse the XML response of a method in PHP.Below is my response. Response:
Nivetha T
  • 481
  • 1
  • 3
  • 17
1
vote
1 answer

Error when parsing the webservice response in PHP

I am at the learning stage of PHP. I have tried to invoke a sample webservice from a single PHP script. I started with StockQuote service. Below is the script I have written.
Nivetha T
  • 481
  • 1
  • 3
  • 17
1
vote
1 answer

SimpleXMLElement Add Child Closure

I'm trying to create a simple XML document but I'm having difficulty grouping the children appropriately. My XML should look like this: test test2
Ken J
  • 4,312
  • 12
  • 50
  • 86
1
vote
1 answer

SimpleXML namespaced attributes and value is empty?

I have the following type of XML structure: test
Jake Wilson
  • 88,616
  • 93
  • 252
  • 370
1
vote
1 answer

Getting info from a specific XML Node

I am trying to read the value for 3 specific XML nodes (bill_codes, sent_total, clicked_unique_total) I have done a lot of testing and I feel like I need someone with fresh eyes to look at this and help me find out what I no longer see.. I am using…
Yaco Zaragoza
  • 429
  • 1
  • 7
  • 18
1
vote
1 answer

PHP SimpleXML ForEach

I am trying to echo out each block in my XML, minus the CDATA. But for some reason I am only getting the first one. What am I doing wrong? My XML: 1421724317
LSD
  • 525
  • 1
  • 6
  • 12
1
vote
1 answer

PHP parse ?

I'm stuck parsing this label with SimpleXML PHP. This is my file: And I want to parse name…
ndnd
  • 11
  • 1
1
vote
3 answers

how to select nodevalue based on another nodevalue via php ?

I have a xml file which contains this : - 39824 4 5 - .... Now…
1
vote
1 answer

php - xml. Is it possible to access particular xml node without looping through all data of xml file

Xml file like this 4 cars 5 staff-required Want to get value of where…
Andris
  • 1,434
  • 1
  • 19
  • 34
1
vote
1 answer

PHP - Dynamically append web page to sitemap.xml

I have a site that searches through a database of websites. I am trying to get to append an url to sitemap.xml whenever the search returns a single result. I know I would need to use simplexml but I'm not sure how to implement it. Pseudo Code if…
StackOverflower
  • 1,031
  • 2
  • 12
  • 21
1
vote
1 answer

Simple XML variable returns "0"

Ok, so im working with tumblr's API and im using SimpleXMLElement with php and ive run into a problem. Basically, when I call on a variable it just prints a zero. for instance : posts->post[0]->photo-url[5]; ?> This just breaks…
1
vote
2 answers

Parsing XML element & attributes with PHP

I'm new to PHP and have been trying to write an xml parser, but have hit a wall and it's driving me bonkers! What I'm trying to do: Write a parser that loops through an XML file accessing both element & attributes, storing the results to a MySQL…
Perp1exed
  • 179
  • 1
  • 10
1
vote
1 answer

Remove duplicates from SimpleXML Object

I was hoping I could get some help with something I am struggling with. I parsing an XML feed with SimpleXML but, I am trying to remove the duplicates. I have done a lot of research and can't seem to get this sorted. Best approach would be…
Texan78
  • 687
  • 2
  • 16
  • 42
1
vote
1 answer

XML get Item ID without Foreach

How can I directly call id="url1" without a foreach? Like this: echo $item->url1; // Output: http://url1.com This is code I have: http://url1.com/
rraayy
  • 119
  • 8
1
vote
2 answers

Read XML with PHP

I am trying to check a field in some XML that is returned from an outside. The XML is returned in a variable call $out and when you view the source of the page you get a XML output of the following,
sea_1987
  • 2,902
  • 12
  • 44
  • 69