Jump to content

Recommended Posts

Hi,

 

I need to send the XML contents of an URL into an array, so i can use certain variables returned by the URL in other function calls… for example

 

The URL i'm dealing with is formatted like so: https://[static_url_goes_here.com]/request=[variable_guid_goes_here]

 

If displaying this URL in a browser window, it looks like a normal .XML document.

 

However, since the variable following the "/request" is different every time, and does not end in .XML, how can i pass the results of this URL into a variable so I can extract data from the returned XML?

 

I did originally try something very basic with simplexml_load_(string/file) ... but didn't get very far.

 

Any information would be very much appreciated :)

Maybe use file_get_contents to get the url data in a string variable and then parse it with some XML parsing tool, say for example PHP's DOMDocument (or simplexml).

 

Thanks for the quick reply :)  I'll give this a shot tomorrow at work.

 

Cheers

Maybe use file_get_contents to get the url data in a string variable and then parse it with some XML parsing tool, say for example PHP's DOMDocument (or simplexml).

 

Thanks for the quick reply :)  I'll give this a shot tomorrow at work.

 

Cheers

 

Hi,

 

FYI, this worked perfectly.

 

I tried the first time and received an error "Message : file_get_contents() [function.file-get-contents]: Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? "

 

... did a bit of Googling, turned out I needed to install the OpenSSL extension for PHP.

 

I did this, then re-tried my code and it's working..

 

Thanks again.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.