Help with Curl PHP

Asked

Viewed 205 times

1

I have a requisition cURL and generally the WebService that conecto takes 8 seconds to return a JSON 600,000 lines.

The problem is when I open a tab to make this request

ex: http://localhost/system/search

If this tab is loading and I try to open another in the same domain:

http://localhost/system or http://localhost/system/search

It doesn’t open until the PHP just made the cURL.

Does anyone know if there’s a way to fix it?

My code:

    $servidor = "http://localhost:8080/ws/v1/http/servico/disponibilidade";
    $content = str_replace('{idHotel}', $input['idh'], $jsonServ);

    $ch = curl_init($servidor);

    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($content),
        'Accept: application/json')
    );

    $result = curl_exec($ch);

    echo $result;

I need to make sure that segá allowed to do two simultaneous searches in two or more tabs.

  • Is this code all the code on the page or is there something else? If you have anything else, I think you have another issue with Curl mentioning the same problem, see if this solves.

  • @Inkeliz worked perfectly Thank you. Really that was the problem my system has more code together.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.