Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cihankusmez's avatar

Guzzle or Curl For Handling Vpos Requests ?

Hi,

I'm converting my e-commerce project to Laravel. I was using cURL for vpos requests.

$ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $this->_server);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_TIMEOUT, 90);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $vPOSData);

        $ch = curl_exec($ch);
        @curl_close ($ch);
        return $ch;

When i dd for $VPosData i get correct results. But i'm getting blank page. I think there exists a problem with cURL in Laravel.

In my project it is working but in Laravel it fails. Some of friends in Stack offers me Guzzle.

I tried Guzzle like

    $client = new Client();
    return $client->post($this->_server, $vPOSData);

Also it fails and i got a blank page. I stucked. What should i do ?

Normally the system post data the bank. And redirects 3D secure page for sms password. But blank page and no redirecting.

0 likes
2 replies
kuroi's avatar

Laravel has no problem with PHP's CURL implementation or the more elegant guzzle - I've used both. More likely the issue is somewhere else in your conversion. Are you sure that $this->_server is properly set in your converted code? What do curl and Guzzle return? i.e. if you dd($client->post($this->_server, $vPOSData));

cihankusmez's avatar

dd($vpos) Result

"clientid=50*****90&amount=125.00&oid=34&okUrl=http%3A%2F%2Flaravel%2Ftr%2Forder%2Ffp1%2Fsuccess&failUrl=http%3A%2F%2Flaravel%2Ftr%2Forder%2Ffp1%2Ffail&islemtipi=Auth&taksit=&storetype=3d_pay&cardHolder=cihan+k%C3%BCsmez&pan=4531444531442283&Ecom_Payment_Card_ExpDate_Month=12&Ecom_Payment_Card_ExpDate_Year=18&cv2=001&rnd=0.99114300+1447433824&hash=nqw8YPuH751prKNbRdDQCjSofN0%3D&lang=tr&currency=949&customerIP=127.0.0.1&vpos_name=Halkbank+vPOS"

dd($this->_server) Result

"https://entegrasyon.asseco-see.com.tr/fim/est3Dgate"

dd($client->post($this->_server, $vPOSData)) Result

Argument 3 passed to GuzzleHttp\Client::request() must be of the type array, string given, called in /var/www/vhosts/laravel/vendor/guzzlehttp/guzzle/src/Client.php on line 87 and defined

Please or to participate in this conversation.