lexik / LexikPayboxBundle

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

Possibility of using an http proxy #74

Open lucuhb opened 8 years ago

lucuhb commented 8 years ago

Hi, First, thanks for this bundle !

I have a problem with the bundle because my server should use an HTTP Proxy to go out and access the paybox server. Here is the error : "Warning: DOMDocument::loadHTML(): Empty string supplied as input" in vendor/lexik/paybox-bundle/Paybox/AbstractRequest.php at line 152

To access to the paybox server, a new curl option CURLOPT_PROXY should be added in the getWebPage function of AbstractRequest.php, like this :

 protected function getWebPage($url)    {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL,            $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($curl, CURLOPT_HEADER,         false);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); 
    curl_setopt($curl, CURLOPT_PROXY,'xxx.xxxx.xxx.xx:port' true); <- this line
    $output = curl_exec($curl);
    curl_close($curl);
   return (string) $output;
}

Is it possible to add new parameters in configuration of this bundle to define the IP address of the HTTP proxy and its port and, if they are defined , add the necessary line in getWebPage function?

Thanks