You need to look into the way fog does it now. I believe it calls one of the scripts under {webdir}/fog/service/, passing in as POST arguments the information needed to create the task in the database and file under /tftpboot/pxelinux.cfg/
If you expand out the /tftpboot/fog/images/init.gz (instruction on wiki), and look into the /bin/fog folder, you’ll see the fog.man.reg file, which is what runs when you choose the Full Host registration and inventory from the PXE boot menu. If you can look through that file, you can see how the script is calling the page which creates the imaging task, and you can replicate that in whatever program you are wanting to interface with FOG.