Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8038197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:09:18+00:00 2026-06-05T03:09:18+00:00

I need a PHP cURL configuration so that my script is able to send

  • 0

I need a PHP cURL configuration so that my script is able to send requests and ignore the answers sent by the API.

curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
//curl_setopt($ch, CURLOPT_TIMEOUT_MS, 100);
$result = curl_exec($ch);
echo $result;
curl_close ($ch);

I tried adding:
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
//curl_setopt($ch, CURLOPT_TIMEOUT_MS, 100);

But its not working properly and the API webserver is not receiving the requests.

The reason for this is I am sending large amount of requests to the API therefore my script is very slow because it waits for each and every request.

Any help is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:09:21+00:00Added an answer on June 5, 2026 at 3:09 am

    Sender file example ./ajax/sender.php

    Script sending POST -> it makes full request to host, but it doesn’t wait on answer from server : CURLOPT_HEADER(0) we dont needs headers from server) and CURLOPT_RETURNTRANSFER (false) we don’t needs data from server.CURLOPT_TIMEOUT – Extra procteted : We waiting after sent only 1ms on respond server, this is extra quaranty to not wait any more ms if server keep us. ### NOTE ### HTTP1.1 has one package max 16kb. HTTP2 has 36kb one pacakge. If POST are more biggest, server will be send with many packages in series = $SIZE%16kb

        $url = 'https://127.0.0.1/ajax/received.php';
        $curl = curl_init();                
        $post['test'] = 'examples daata'; // our data todo in received
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt ($curl, CURLOPT_POST, TRUE);
        curl_setopt ($curl, CURLOPT_POSTFIELDS, $post); 
        
        curl_setopt($curl, CURLOPT_USERAGENT, 'api');
    
        //curl_setopt($curl, CURLOPT_TIMEOUT, 1); //if your connect is longer than 1s it lose data in POST better is finish script in recevie
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl,  CURLOPT_RETURNTRANSFER, false);
        curl_setopt($curl, CURLOPT_FORBID_REUSE, true);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 1);
        curl_setopt($curl, CURLOPT_DNS_CACHE_TIMEOUT, 100); 
        
        curl_setopt($curl, CURLOPT_FRESH_CONNECT, true);
        
        curl_exec($curl);   
        
        curl_close($curl);  
    

    Received file example ./ajax/received.php

        ignore_user_abort(true); //if connect is close, we continue php script in background up to script will be end
        
                header("Connection: close\r\n"); 
                header("Content-Encoding: none\r\n"); 
                header("Content-Length: 1"); 
        ### we just close connect above if webbrowser, or request waiting on answer ( we know we set CURLOP to not wait) ###
    ob_end_clean(); //just flush all content if exists to request. If server still waiting on answer.
                //HERE all script doing in background: Example
                $this->db->query('UPDATE new_hook_memory SET new=new+1 WHERE id=1');
     
    

    EDIT 2019 if you using fastcgi just finish fastcgi and browser close connection but script still will be working up to end.

    How finish script: PHP mod_fcgi with fastcgi_finish_request();

    For Apache2:

    ob_end_flush();
    flush();
    

    For php-fpm

    fastcgi_finish_request(); $this->db->query('UPDATE new_hook_memory SET new=new+1 WHERE id=1');
    

    Old version:

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write a php script, that will do a POST request to
I need to login with my account with php curl in a website that
I need a .php script that will download a lot of images from another
I need a php script that accepts a URL via a get request and
I have a need to rename a file after download using php cURL. Here's
I need a php code and sql code that will let someone upload an
I need a PHP script to decrypt the RSA encrypted string generated by this
I need a PHP Regex that can parse .strings files. In particular, it needs
I need a php script to read a .txt file. The content of the
I need some PHP classes that deal with image processing in a good manner.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.