making an https request with POST method in osCommerce

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello everybody,

I have an osCommerce shopping cart on my site, which is an open-source
product that uses php. I'm very new to php. I also have an online
scheduling application that I outsourced to a third party, which
resides on a different server. I asked my scheduling provider if there
was anyway I could use my osCommerce php registration for thier
registration so I could avoid having visitors to the site register and
sign-in twice, once for the store and once to schedule appointments.

I was told I would need to create an https request using the POST
method. This seemed like pretty standared scripting activity based on
my limited knowledge.

I did some research and it seems as though cURL is the easiest way to
do this. At first my hosting company did not support cURL. I wrote to
some osCommerce forums asking for help. I found out that my company
did begin supporting cURL and I thought maybe I could use it. I sent
some people at an osCommerce forum my phpinfo() file at . After reviewing this,
someone at the forum told me my host had cURL enabled but without SSL
support, which meant I needed to "install the command line of cURL." I
was told without ssh/telnet access I couldn't do this and I don't have
ssh/telnet access.

I shared the information with someone else on a newsgroup who said
they couldn't see why I still couldn't use cURL for my purposes.

Figuring I had nothing to lose, I did some experimenting. I don't know
exactly what I'm doing, but I'm encouraged just to be getting error
messages because maybe that will give me some indication of what to do
with some help.

In catalog/login.php:

In place of this:
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('login',
tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')); ?>

I put this:
<!-- body_text //-->
<td width="100%" valign="top">
// make an https request using POST w_curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL," ?");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
curl_exec ($ch);
curl_close ($ch);

echo tep_draw_form('login', tep_href_link($ch, 'action=process',

I changed some of the CURLOPT_POSTFIELDS for security. I also
eliminated some fields here for space. Basically these are request
paramaters that use the registration fields. The information in the
fields are high level administrative user login information. I'm tryin
to access the scheduling application through the osCommerce

When I tested the new script I got this:
404 Not Found
The requested URL /giftcertificate/nfoscomm/catalog/Resource id was
not found on this server.

I think this means one of two things:
1. The https request is not communicating with the third-party
scheduling server like it should. It is still communicating the the
osCommerce server.
2. The id in CURLOPT_POSTFIELDS is incorrect. In that case, all I
would need to do is get the correct ID from my vendor. I suspect it
isn't that easy but I can hope.

Does anyone have any ideas?

Re: making an https request with POST method in osCommerce

Quoted text here. Click to load it

My suggestion is this:=20
Instead of directly dealing w/ catalog/login.php in the first place, you =
might want to try writing your functionality into a totally separate =
file that stands alone. Make that work first, then start working on =
integrating that into one of the OSCommerce pages.

I also suggest that once you get the cUrl stuff working and you can =
properly login to the 3rd party server, you do it as maybe a hidden =
<iframe> or maybe do a popup window that hides itself once it is finished. This way you have minimal changes in your osCommerce files and =
linking them will be a simple include which wouldn't hurt anything and =
can be removed just as easily.

I really think you should start from there and move forward from that =

Hope this helps -

Wil Moore III, MCP | Integrations Specialist

Re: making an https request with POST method in osCommerce

Thanks Wil,

I'm going to try that out. If it works out, am I allowed to post your
suggestion (with my execution code) to an osCommerce forum
( It might help someone else. Thanks

Quoted text here. Click to load it

Site Timeline