Xbee S6B send data to PHP website

I want to make a switch control through my website. and send and recieve data. As i am using Dynamic IP , so every time when embedded system is turned ON we send out IP and Port number to mysql to save and thus use this information control the switch.

I want Xbe S6B to transfer data and recieve data from Mysql php from my website.
I am new to Xbee. I want to use PIC16F877A as controller for my embedded system.
Please suggest me how tpo use TCP IP protocol in XBEE S6B.
Help me with code which AT command I have to send and packet structure for data to send trough XBEE.