Page 1 of 1

Converting Powershell script to PHP page

Posted: Fri Feb 17, 2012 2:33 pm
by trsix
Hello, first time reader, first time PHP'er first time poster.

I've got a pretty good working knowledge of Powershell and see that PHP seems to be based upon a similar structure (C).

I have a working powershell script which does the following:
Connects to a remote server and initiates a SOAP request using credentials and then parses the response back, formats it into a table and updates a webpage.

I am attempting to get this working from within a PHP page.

Where I am having difficulty is in setting up the initial SoapClient. If I have a very simple page and just put in the line:

Code: Select all

<?php $client = new SoapClient("http://www.example.com/webservices/"); ?>
note:im not using example.com in my actual script, but the page fails regardless of what goes in that line
I get an "HTTP 500 Internal Server Error" message.

What is wrong with that line? Every example I see regarding SOAP requests has that line somewhere in it and yet as soon as I put that line in, the page breaks.

Hopefully someone can assist me in getting this ported over to PHP, thanks

Re: Converting Powershell script to PHP page

Posted: Fri Feb 17, 2012 3:46 pm
by trsix
well, I figured it out. Turned out to be because of the authentication... or lack there of.

This worked.

<?php $client = new SoapClient("http://www.example.com/webservices", array('login' => 'myloginname', 'password' => 'mypassword')); ?>