I am using PHP to interact with a Web Service using REST and HTTP GET requests to call on the available APIs to return XML data. When testing via the address bar, I get the expected XML content.
So the next step I tried was to read that XML data or store the values returned into a string. But when I use file_get_contents I don't get anything back. No error messages, no nothing. Just a blank page with no source.
Where am I going wrong?
<?php
$base = 'https://www.example.com/webservice.asmx';
$params = array('ID' => '12345',
FirstName' => 'Joe',
'Surname' => 'Bloggs');
$url = $base . '/IsMember?' . http_build_query($params);
$response = file_get_contents($url);
echo $response;
?>
The XML that should be getting read is:
<?xml version="1.0" encoding="utf-8"?>
<boolean xmlns="http://www.example.com/">false</boolean>