Page 1 of 1

Consume a RESTful web service using PHP

Posted: Tue Apr 29, 2014 11:23 am
by ken4ward
Very quick please. I have a RESTful service created in Java that I want to consume using PHP. I am very new to PHP and how to use it to consume web services. This is all I have so far: I just want to display the values by echoing them. This is to test that I'm able to connect successfully.

Code: Select all

<?php
	$url = 'http://localhost:8080/WMWS/webresources/entity.userregistration';
	$xml = simplexml_load_file($url);
	foreach($xml->item as $item)
	{
		echo $item;
	}
?>
your professional help is highly needed.

Re: Consume a RESTful web service using PHP

Posted: Tue Apr 29, 2014 11:35 am
by Celauran
What errors are you encountering?

Re: Consume a RESTful web service using PHP

Posted: Tue Apr 29, 2014 11:40 am
by ken4ward
Celauran wrote:What errors are you encountering?
Not displaying any error. It displays a blank page. When i echoed a static (echo "start") content it displayed it (start).

Re: Consume a RESTful web service using PHP

Posted: Tue Apr 29, 2014 12:03 pm
by Celauran
Check that you have error reporting enabled. Use var_dump to check that $xml contains what you'd expect.