HTTP_REQUEST for a secure URL - not working

Discussion in 'Programming' started by Genisys, Apr 28, 2010.

  1. #1
    If you copy this URL into a web browser:

    https://spgtest.hypercom.com/SmartPayments/transact2.asmx

    You get the page loaded. I would have expected my php script here to echo back at least something:

    <?php
    require_once 'HTTP/Request.php';
    $req - new HTTP_Request("https://spgtest.hypercom.com/SmartPayments/transact2.asmx");
    $req->sendRequest();
    $response = $req->getResponseBody();
    echo "$response\n";
    ?>

    The above scripts works find using a different URL with http verses https, so I think there's some differences in a secure request call, but I can't seem to get a response from any URL beginning with https (secure). Replacing the "https" with "http" causes the browser to hang, as does my script, so at least that is consistent. Can anyone tell me what is not correct about my logic/syntax above? I just can't find any good samples/examples/info on the web about what my possible problem(s) could be.
     
    Genisys, Apr 28, 2010 IP
  2. nolag

    nolag Member

    Messages:
    201
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    28
    #2
    Well for one HTTP is on port 80 by default and HTTPS is on 443 by default so I don't know think the HTTP site would respond to a request on post 443.
     
    nolag, Apr 28, 2010 IP
  3. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    For me, it looks like a simple syntax error.

    Replace
    $req - new HTTP_Request("https://spgtest.hypercom.com/SmartPayments/transact2.asmx");
    PHP:
    with

    $req = & new HTTP_Request("https://spgtest.hypercom.com/SmartPayments/transact2.asmx");
    PHP:
    You might be interested with the cURL method as well. See How to do a http request using php
     
    NeoCambell, Apr 30, 2010 IP