Converting Powershell script to PHP page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
trsix
Forum Newbie
Posts: 4
Joined: Fri Feb 17, 2012 2:20 pm

Converting Powershell script to PHP page

Post 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
trsix
Forum Newbie
Posts: 4
Joined: Fri Feb 17, 2012 2:20 pm

Re: Converting Powershell script to PHP page

Post 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')); ?>
Post Reply