Is there any way to save an XML attribute as a PHP variable and automatically place it in another http request? Or is there a better way to do that?
Basically, I send a server an http request, the code I get back looks something like this:
<tag one="info" two="string">
I need to save the string in attribute two and insert it in an http request that looks something like this:
http://theserver.com/request?method=...&id=123456
The ‘123456’ ID needs to be the string in attribute ‘two’.
Any help would be appreciated!
Thanks,
Jane
If you are 100% entirely absolutely completely TOTALLY sure that the content will always have that exact format, you can probably use regex as the other answers have suggested.
Otherwise, DOM isn’t very hard to manage…
If you have a real example of the XML that you’ll receive, please do post it and I’ll adapt this answer for it.