Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 933861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:54:04+00:00 2026-05-15T20:54:04+00:00

I having trouble posting XML to a payment gateway using PHP. The gateway (PSiGate)

  • 0

I having trouble posting XML to a payment gateway using PHP.

The gateway (PSiGate) gives this sandbox url to POST XML to: https://dev.psigate.com:8645/Messenger/AMMessenger

Here the code:

if (isset($_POST) && $_GET['task'] == 'new') {
    $dealer = new Dealer($USER->getDealerId());
    $contact = $dealer->getContact();
    // new PSiGate Account
    $xml  = '<?XML version="1.0"?>';
    $xml .= "<Request>\n";
    $xml .= "   <CID>10000001</CID>\n";
    $xml .= "   <UsertID>teststore</UserID>\n";
    $xml .= "   <Password>testpass</Password>\n";  
    $xml .= "   <Action>AMA01</Action>\n";  
    $xml .= "   <Account>\n";
    $xml .= "       <AccountID>".$USER->getDealerId()."</AccountID>\n";
    $xml .= "       <Name>".$contact->getFirstname()." ".$contact->getFirstname()."</Name>\n";
    $xml .= "       <Company>".$contact->getCompany()."</Company>\n";
    $xml .= "       <Address1>".$contact->getAddressLine1()."</Address1>\n";
    $xml .= "       <Address2>".$contact->getAddressLine2()."</Address2>\n";
    $xml .= "       <City>".$contact->getCity()."</City>\n";
    $xml .= "       <Province>".$contact->getProvince()."</Province>\n";
    $xml .= "       <Postalcode>".$contact->getPostalCode(TRUE)."</Postalcode>\n";
    $xml .= "       <Country>".$contact->getCountry()."</Country>\n";
    $xml .= "       <Phone>".$contact->getWorkPhone(TRUE)." EXT. ".$contact->getWorkPhoneExt()."</Phone>\n";
    $xml .= "       <Fax>".$contact->getFaxPhone(TRUE)."</Fax>\n";
    $xml .= "       <Email>".$contact->getEmail()."</Email>\n";
    $xml .= "       <CardInfo>\n";
    $xml .= "           <CardHolder>".$_POST['Bname']."</CardHolder>\n";
    $xml .= "           <CardNumber>".$_POST['CardNumber']."</CardNumber>\n";
    $xml .= "           <CardExpMonth>".$_POST['CardExpMonth']."</CardExpMonth>\n";
    $xml .= "           <CardExpYear>".$_POST['CardExpYear']."</CardExpYear>\n";
    $xml .= "       </CardInfo>\n";
    $xml .= "   </Account>\n";
    $xml .= "</Request>\n";
    $fp = fsockopen("dev.psigate.com", 8645, $errno, $errstr, 30);
    if (!$fp)    {
        echo 'Failed to open connection.';
    } else {
        $contentlength = strlen($xml);
        $out  = "POST /Messenger/AMMessenger HTTP/1.0\r\n";
        $out .= "Host: ssl://dev.psigate.com\r\n";
        $out .= "Connection: Keep-Alive\r\n";
        $out .= "Content-type: application/x-www-form-urlencoded\r\n";
        $out .= "Content-length: $contentlength\r\n\r\n";
        $out .= "XML=$xml";
        fwrite($fp, $out);
        while (!feof($fp)) {
            $theOutput .= fgets($fp, 128);
        }
        fclose($fp);
        echo "there should be output";       
        echo $theOutput;
    } 
}

I don’t get any output just the message: “there should be output”, and script runs for about 45 secs or so I believe it’s doing something..lol!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:54:05+00:00Added an answer on May 15, 2026 at 8:54 pm

    try:

    <?php
    if (isset($_POST) && $_GET['task'] == 'new') {
        $dealer = new Dealer($USER->getDealerId());
        $contact = $dealer->getContact();
        // new PSiGate Account
        $xml  = '<?XML version="1.0"?>' . "\n";
        $xml .= "<Request>\n";
        $xml .= "   <CID>10000001</CID>\n";
        $xml .= "   <UsertID>teststore</UserID>\n";
        $xml .= "   <Password>testpass</Password>\n";  
        $xml .= "   <Action>AMA01</Action>\n";  
        $xml .= "   <Account>\n";
        $xml .= "       <AccountID>".$USER->getDealerId()."</AccountID>\n";
        $xml .= "       <Name>".$contact->getFirstname()." ".$contact->getFirstname()."</Name>\n";
        $xml .= "       <Company>".$contact->getCompany()."</Company>\n";
        $xml .= "       <Address1>".$contact->getAddressLine1()."</Address1>\n";
        $xml .= "       <Address2>".$contact->getAddressLine2()."</Address2>\n";
        $xml .= "       <City>".$contact->getCity()."</City>\n";
        $xml .= "       <Province>".$contact->getProvince()."</Province>\n";
        $xml .= "       <Postalcode>".$contact->getPostalCode(TRUE)."</Postalcode>\n";
        $xml .= "       <Country>".$contact->getCountry()."</Country>\n";
        $xml .= "       <Phone>".$contact->getWorkPhone(TRUE)." EXT. ".$contact->getWorkPhoneExt()."</Phone>\n";
        $xml .= "       <Fax>".$contact->getFaxPhone(TRUE)."</Fax>\n";
        $xml .= "       <Email>".$contact->getEmail()."</Email>\n";
        $xml .= "       <CardInfo>\n";
        $xml .= "           <CardHolder>".$_POST['Bname']."</CardHolder>\n";
        $xml .= "           <CardNumber>".$_POST['CardNumber']."</CardNumber>\n";
        $xml .= "           <CardExpMonth>".$_POST['CardExpMonth']."</CardExpMonth>\n";
        $xml .= "           <CardExpYear>".$_POST['CardExpYear']."</CardExpYear>\n";
        $xml .= "       </CardInfo>\n";
        $xml .= "   </Account>\n";
        $xml .= "</Request>\n";
        $fp = fsockopen("ssl://dev.psigate.com", 8645, $errno, $errstr, 30);
        if (!$fp)    {
            echo 'Failed to open connection.';
        } else {
            $contentlength = strlen($xml);
            $out  = "POST /Messenger/AMMessenger HTTP/1.1\r\n";
            $out .= "Host: dev.psigate.com\r\n";
            $out .= "Connection: close\r\n";
            $out .= "Content-type: application/x-www-form-urlencoded\r\n";
            $out .= "Content-length: $contentlength\r\n\r\n";
            $out .= "XML=$xml";
            fwrite($fp, $out);
            while (!feof($fp)) {
                $theOutput .= fgets($fp, 128);
            }
            fclose($fp);
            echo "there should be output";       
            echo $theOutput;
        } 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 528k
  • Answers 528k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Should have dug around in Locals a bit more: xmlBinaryDocument.removeAttribute… May 16, 2026 at 11:06 pm
  • Editorial Team
    Editorial Team added an answer file_get_contents() reads the entire file into memory, which could be… May 16, 2026 at 11:06 pm
  • Editorial Team
    Editorial Team added an answer You're stuck in an infinite loop there as you're only… May 16, 2026 at 11:06 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Apologies for duplicate posting. Hi I am having trouble marshalling a linked list from
I'm having trouble with an SMS message I am sending using a provider called
I know I'm doing this a bad way... but I'm having trouble seeing any
I am having trouble selecting this with watir. I'm trying xpath and is able
I'm having trouble figuring out how to add a custom column type to a
I'm having trouble getting my custom events to fire. My regular events work fine,
I am having trouble figuring out the reason why my .c code is having
I am trying to do a seemingly simple thing, but having trouble accomplishing it.
I am playing with cURL, and I am having trouble getting it to work.
Having trouble working out how to do the following - I want to list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.