Asterisk, PHP and XML Implementation Problem

Hi there,

I am attempting to create a PHP script that connects to Asterisk Manager, sends it a few commands and retrieves the XML response from it.

It seems as though I can only do this using file_get_contents($hostPortAction) - where the $hostPortAction contains the details of the location of asterisk and the action to take.

Now, when I initially do a ‘login’ request, the response comes back as successful in XML - great! However, when I send another command such as ‘status’, it comes back telling me that authentication is required. I have attempted putting both commands one after the other - same response. I think the problem is with the file_get_contents function, but how do I go around it? Anyone have any ideas??

I can perform this (login + other commands) using sockets, fputs and fgets in PHP but they return plain text and what I want is XML so hopefully someone can help! Otherwise I’m stuck with sockets and there will be a lot of unwanted parsing to do :open_mouth:

I hope someone has more ideas!!

Thanks, Ed