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

andremellow's avatar

DomCrawler - cURL error 52: Empty reply from server

I'm doing a script to upload a file to a third party system we have.

I super simple. Auth basic, go to URL and upload. Unfortunally is not working as expected

        $client = new Client();
        
        $client->setAuth('xxxxx', 'xxxxxx');
        $crawler = $client->request('GET', 'xxxxxxx');
        
        $button = $crawler->selectButton('btnImportCSV');
        $form = $crawler->selectButton('btnImportCSV')->form();

        $form['importfilename']->upload('C:\contact.csv');
        $form['PAGEID']->setValue("39,1");

        //dd($form);

        $crawler = $client->submit($form);

        //dd($crawler);

At this point I get an error

ConnectException in CurlFactory.php line 186:
cURL error 52: Empty reply from server (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

if I print $form before submit it looks ok.

Any guess?

0 likes
1 reply
andremellow's avatar

The form has an event onsubmit="return false;"

Maybe this is the problema. How to remove it? is that possible?

Please or to participate in this conversation.