Create a secure webservice in PHP
<p>I need some help understanding concepts as Im not sure how to achieve this. </p>

<p>I've got a database up on the web and it works pretty well with php which its written in. I now need to create the ability for an asp.net page to query my php database and return the results in a format which is fairly easy to manipulate at the other end, json would be good.</p>

<p>The problem I have is the security of the php database. If I have the credentials embedded in the file (like below), I run the db being insecure to queries. So doing some research, it looks like I need to look into webservices as I can pass the username and password from the ASPX page securely using SOAP headers. Can someone confirm that is true?</p>

<pre><code>$databaseName = 'MySample';
$userName = 'MyUserName';
$passWord = 'MyPassword';

$db = &amp; new Database();
$db-&gt;setProperty('database', $databaseName);
$db-&gt;setProperty('username', $userName);
$db-&gt;setProperty('password', $passWord);

//this is the find
$findCMD = $db-&gt;newFindCommand('Web');
$findCMD-&gt;AddFindCriterion('Field1',$_POST['Param1']);
$findCMD-&gt;AddFindCriterion('Field2',$_POST['Param2']);

//finally execute and return $Results back to the ASPX app
$Results = $findCMD-&gt;execute();
</code></pre>

<p>Can SOAP return results as JSON, or is it specifically XML? I've also been trying to find some turorials in setting up a webservice for PHP 5.3, most of them point towards nusoap - ive tried to follow a basic tutorial which failed. According to reports this library isnt compatible with 5.3 and there is a port, but is that the best library to try and use or shall I try and use the built in soap library, which there are not many tutorials about?</p>

<p>My main objective is to provide secure access to my PHP Database from an ASPX page, PS everything is being done in HTTPS.</p>

<p>Any advice would be great, continuing on my search in the meantime to sift through RESTful services, see if they are what I should be using.</p>

<p>Thanks as always </p>
