0

I'm trying to extract some attributes from an XML file. I'm using simple xml_load_file() function to load the xml and saved it in a variable. When I print the variable I get this

SimpleXMLElement Object
(
[SERVICE_HTTP_PATH] => https://land-qc.qoda.com
[L10] => https://jd10.loda.com
[TEMP_HTTP_PREVIEW_PATH] => https://land.qoda.com/temp_preview_path
)

I want to use SERVICE_HTTP_PATH which has the https://land-qc.qoda.com. How do I capture the url alone in a variable? Thanks in advance.

2
  • try $yourobject->SERVICE_HTTP_PATH Commented Mar 28, 2017 at 12:09
  • I get this SimpleXMLElement Object ( [0] => https://jdws-qc.qoda.com ) but I want only the url. Commented Mar 28, 2017 at 12:12

1 Answer 1

2

Convert your object into array like this

$array= (array) $yourobject;

after that you can do this

$url = $array['SERVICE_HTTP_PATH'];

This should give you your value.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.