Hi All,
I have an off-site shopping cart that I want to inegrate with my site. In it's simplest form, I would simply have a link to a product and the user would be taken off-site to my shopping cart. However, I'd like to integrate a form to allow multiple purchases to happen at once. To do this, I need to a.) hit each URL to assign each specific product to the shopping cart, then b.) put a checkout on my site that brings them to the off-site URL for payment.
I used the code below just to test, but after accessing the link, it didn't work....In production, this file would receive a POST message with any products selected.....(e.g. Product 1, Product 2)
<?php
//fopen()
fopen("link to product","rb");
// or I used file_get_contents()
file_get_contents("link to product");
?>
<a href="link to cart checkout">checkout</a>
When I do this process manually, it works, but this very simple example will not work. I also got it to work in javascript, but want to do this on the server-side. Any ideas?
By the way, by working I mean I access the product URL (or several of them) then go to the main checkout URL and all of my products are listed. My assumption is that the offline site uses cookies or sessions...would 'fopen()' of 'file_get_contents()' not set the cookie? How come I can in Javascript? I guess my question is a.) how can I open a page in PHP without opening a window, but setting a cookie from that URL or b.) another way around this?
Thanks in advance!
Open URL Internally in PHP Code w/o Open Window - Shop Cart
Moderator: General Moderators
-
drsmartman
- Forum Newbie
- Posts: 4
- Joined: Tue Mar 23, 2004 6:27 pm
-
drsmartman
- Forum Newbie
- Posts: 4
- Joined: Tue Mar 23, 2004 6:27 pm
Yeah, I think my question wasn't too clear, but that's not what I'm looking for. We already have another site that acts as a shopping cart/checkout system. So, in order for me to add multiple products to one checkout, I need to access a URL for each product. However, it is not very usable to buy one product at a time so when the customer clicks "checkout" they leave my site and see all of the items listed in their shopping cart. Essentially, I just need something on the server-side (PHP) that acts like 'document.open()' in javascript (with parameters for NOT opening a window). I thought 'fopen()' or 'file_get_contents()' would do the trick.....
thanks anyway
thanks anyway
-
drsmartman
- Forum Newbie
- Posts: 4
- Joined: Tue Mar 23, 2004 6:27 pm
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
-
drsmartman
- Forum Newbie
- Posts: 4
- Joined: Tue Mar 23, 2004 6:27 pm
I tried to find if there was just a big URL I could pass with all of the product IDs/quantities, but nothing going. Oh, and the cookie thing IS the problem. No, the shopping cart software is no on site. For example, clicking a product buy button would theoretically go from my site to http://othersite.com/product=xyz, then to checkout. However, instead of only having product xyz, I'd like to have abc, def, etc....the other site accomplishes this through cookies. Back to the drawing board....