preg_match

PHP – use a regular expression to extract a URL from XML attribute

I was working on an API response, which provided data in a custom XML markup within the string, which was returned. I wanted to simply extract the “linkTerm”. The snippet I got looked like this: <link linkTarget=”URL” linkTerm=”https://some.provider.com/lib/something/detail.action?docID=5176530″ linkWindow=”_blank”>Online-Zugang</link> Now surely there will be more elegant ways of doing it, but I felt that I […]

Scroll to top