lexik / LexikPayboxBundle

LexikPayboxBundle eases the implementation of the Paybox payment system
MIT License
40 stars 47 forks source link

Warning: DOMDocument::loadHTML(): Empty string supplied as input #93

Closed rsoufir closed 6 years ago

rsoufir commented 6 years ago

Hi there !

I can not call the paybox payment page with LexikPayboxBundle.

Here is the error message: "Warning: DOMDocument :: loadHTML (): Empty string supplied as input".

Here is my configuration:

In config.yml

lexik_paybox: parameters: production: false site: 'XXXXXXX' rank: 'XXX' login: 'XXXXXXXXX' currencies:

In my Controller php :

    $paybox = $this->get('lexik_paybox.request_handler');
$paybox->setParameters(array(
    'PBX_CMD'          => 'CMD'.time(),
    'PBX_DEVISE'       => '978',
    'PBX_PORTEUR'      => 'test@paybox.com',
    'PBX_RETOUR'       => 'Mt:M;Ref:R;Auto:A;Erreur:E',
    'PBX_TOTAL'        => '1000',
    'PBX_TYPEPAIEMENT' => 'CARTE',
    'PBX_TYPECARTE'    => 'CB',
    'PBX_EFFECTUE'     => $this->generateUrl('paiementstatus', array('status' => 'success'), true),
            'PBX_REFUSE'       => $this->generateUrl('paiementstatus', array('status' => 'denied'), true),
            'PBX_ANNULE'       => $this->generateUrl('paiementstatus', array('status' => 'canceled'), true),
        'PBX_RUF1'         => 'POST',
    'PBX_REPONDRE_A'   => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), true),
    ));
    return $this->render(
        'LexikPayboxBundle:Sample:index.html.twig',
        array(
            'url'  => $paybox->getUrl(),
            'form' => $paybox->getForm()->createView(),
        )
    );

You can see my error in the screenshot in attach files.

Thank you in advance for your help !

error_paybox

acidjames commented 6 years ago

@rsoufir can you try to test the routes "paiementstatus" in another context, like just making a link to them using twig ?

i've never seen this error, but it looks like some route generation error

ftila commented 5 years ago

le problème au libcurl: lancer la commande curl coté serveur si vous obtenez les mêmes resultats alors exécuter les commandes qui suivent=>


    <!DOCTYPE html>
    <html>
    <head>
            <title>Server status</title>
    </head>
    <body>
            <div><center>
            <table BORDER="0" WIDTH="100%" HEIGHT="95%">
            <tr><td align="center">
                    <font type="arial"><b>T</b>peweb.<b>P</b>aybox.<b>C</b>om</font><font color="white"> - 24</font>
            </td></tr>
            </table>
            </center></div>
            <div id="server_status" style="text-align:center;">OK</div>
    </body>
    </html>
alexandreb09 commented 5 years ago

I'm getting the same issue and simply fix it by removing the checks.

The error is raised after calling getWebPage on https://preprod-tpeweb.paybox.com/load.html which is returning an empty string.

One simple solution is to remove this call to get the server URL. The server URL are available on the doc.

For example, for a pre-prod test, you can use:

// Server URL
$PAYBOX_DOMAIN_SERVER = "preprod-tpeweb.paybox.com";
$paybox_url = "https://".$PAYBOX_DOMAIN_SERVER."/cgi/MYchoix_pagepaiement.cgi";

The controller becomes:

public function callAction(){

        // Server URL
        $PAYBOX_DOMAIN_SERVER = "preprod-tpeweb.paybox.com";
        $paybox_url = "https://".$PAYBOX_DOMAIN_SERVER."/cgi/MYchoix_pagepaiement.cgi";

        $paybox = $this->get('lexik_paybox.request_handler');
        $paybox->setParameters(array(
            'PBX_SITE'          => "1999888",
            'PBX_RANG'          => "32",
            'PBX_IDENTIFIANT'   => "110647233",
            'PBX_TOTAL'         => "999",
            'PBX_DEVISE'        => "978",
            'PBX_CMD'           => "TEST Paybox".mktime(),
            'PBX_PORTEUR'       => "test@paybox.com",
            'PBX_RETOUR'        => "Mt:M;Ref:R;Auto:A;Erreur:E",
            'PBX_HASH'          => "SHA512",

//            'PBX_TYPEPAIEMENT' => 'CARTE',
//            'PBX_TYPECARTE'    => 'CB',

            'PBX_EFFECTUE'     => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'success'), UrlGeneratorInterface::ABSOLUTE_URL),
            'PBX_REFUSE'       => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'denied'), UrlGeneratorInterface::ABSOLUTE_URL),
            'PBX_ANNULE'       => $this->generateUrl('lexik_paybox_sample_return', array('status' => 'canceled'), UrlGeneratorInterface::ABSOLUTE_URL),
            'PBX_RUF1'         => 'POST',
            'PBX_REPONDRE_A'   => $this->generateUrl('lexik_paybox_ipn', array('time' => time()), UrlGeneratorInterface::ABSOLUTE_URL),
        ));

        return $this->render(
            'LexikPayboxBundle:Sample:index.html.twig',
            array(
                'url'  => $paybox_url, //$paybox->getUrl(),
                'form' => $paybox->getForm()->createView(),
            )
        );
}

I have openned a discussion on StackOverflow with my files detail.

There should have better solution but works for the moment.