PHP and Asterisk newbie

Hi everyone!

Iam here with question, how to build web page wich should do registering new users/phones in Asterisk and more like call between themselves, or look who is registered/connected…
My enviroment is
Apache http server running on windows,
Asterisk 12 running on Ubuntu server (virtualized in windows and second is SSH connection to real server).

Iam confused how to call Asterisk AMI with PHP, or where get started, i was trying to call some asterisk/info etc and i got this:

  1. When calling from PHP with ajax i cant read response, XML parse error.
  2. Acces denied if i try go to direct link, i cant figure out how pass safely user and pass.

So iam missing something very important to me but i cant find what is it.

Please if someone know how to set enivorment to start with something like i described, give me some hints.