PHP call a url returning XML/JSON

ElvansX

New Member
I am absolute beginner in PHP. Sorry for a very basic API question. I am stuck while coding at a point where I need to call a URL which will return me an XML or a JSON. Now I have to capture that in a variable.For an example, I have written the following code:\[code\]class Search { private $documents = array(); public function __construct() { $xmlDoc = new DOMDocument(); $xmlDoc->load("solr.xml"); .....\[/code\]Now I am directly loading an XML. I dont want to do that, instead:Step1: I want to call a http url which returns me an XML or JSON.
Step2: I need to store that in some variable like xmlDoc above
Step3: and later ofcourse I want to parse it. I have no issues with step 3 but I just need some pointers or help as to how can I accomplish step 1 and 2?
 
Back
Top