making an https request with POST method in osCommerce

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Angie

    making an https request with POST method in osCommerce

    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
    http://www.thefragrantpath.com/checkcurl.php. 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(F ILENAME_LOGIN, 'action=process ', 'SSL')); ?>

    I put this:
    <!-- body_text //-->
    <td width="100%" valign="top">
    <?php
    // make an https request using POST w_curl
    $ch = curl_init();
    curl_setopt($ch , CURLOPT_URL,"ht tps://app.timetrade.c om/tc/autologin.do?") ;
    curl_setopt($ch , CURLOPT_POST, 1);
    curl_setopt($ch , CURLOPT_POSTFIE LDS,
    "url=thefragran tpath&id=000000 00CLIENTLOGIN&u sr=receptionist &firstname=Jane &lastname=Doe&u sername=test&pa ssword=000000") ;
    curl_exec ($ch);
    curl_close ($ch);

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

    I changed some of the CURLOPT_POSTFIE LDS 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
    registration.

    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_POSTFIE LDS 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?
    Thanks
  • Guest's Avatar

    #2
    Re: making an https request with POST method in osCommerce

    > In catalog/login.php:

    My suggestion is this:
    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 point.

    Hope this helps -

    _______________ ________
    Wil Moore III, MCP | Integrations Specialist

    Comment

    • Angie

      #3
      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
      (osdox.com)? It might help someone else. Thanks

      <laidbak69@hotm ail.com> wrote in message news:<10fu72lk8 gdv730@corp.sup ernews.com>...[color=blue][color=green]
      > > In catalog/login.php:[/color]
      >
      > My suggestion is this:
      > 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
      > point.
      >
      > Hope this helps -
      >
      >
      > Wil Moore III, MCP | Integrations Specialist
      > --[/color]

      Comment

      Working...