Script to add to cart

We have a flash catalog that we have distributed. In this catalog you can add items to a shopping list which is then sent in xml format to our script. In our script we can access all the product information and quantities ordered. We need a way to add these items to the cart and then redirect the user to the checkout or view cart page. Is there some javascript function we can include to add items to the cart, or some php function we can call to add items to the cart?