How to do a get request twice in PHP?

php prevent resubmission
double submit problem in php
stop form submit on refresh php
multiple form action in php
php reload page with post data
two action in one form php
duplicate email validation in php
form submitting twice in chrome

Here's my current code:

$header = [ 
                'phoneType' => $mobileType
                ];

\Drupal::logger("cam")->debug('PageNameHere retrieveAPINameHere REQUEST: '.json_encode($header));
            $filterPhone = MAPClient2::req( 'get', $context, $header, NULL);

Now, I need to make two request now with a new API with the following request:

{
"configuration": "techDescriptions",
"automated":"<phon>",
"lalaBox":true
}

{
"configuration": "techDescriptions",
"automationBu":"<phoneType>",
"lalaBox":false
 }

Is this the right way to do it?

$header = [ 
                "configuration": "techDescriptions",
                "automationBu":"<phoneType>",
                "lalaBox":false
                ];

$header = [ 
                "configuration": "techDescriptions",
                "automationBu":"<phoneType>",
                "lalaBox":treu
                ];

\Drupal::logger("cam")->debug('PageNameHere retrieveNEWAPINameHere REQUEST: '.json_encode($header));
            $filterPhone = MAPClient2::req( 'get', $context, $header, NULL);

When doing this you overwrite the $header variable. You should maybe have another name that makes more sense for the second header you need to send. I'll put $header2 so you understand but you should find a better name

       $header = [ 
                        "configuration": "techDescriptions",
                        "automationBu":"<phoneType>",
                        "lalaBox":false
                        ];

        $header2 = [ 
                        "configuration": "techDescriptions",
                        "automationBu":"<phoneType>",
                        "lalaBox":treu
                        ];

\Drupal::logger("cam")->debug('PageNameHere retrieveNEWAPINameHere REQUEST: '.json_encode($header));
            $filterPhone = MAPClient2::req( 'get', $context, $header, NULL);

\Drupal::logger("cam")->debug('PageNameHere retrieveNEWAPINameHere REQUEST: '.json_encode($header));
            $filterPhone = MAPClient2::req( 'get', $context, $header2, NULL);

How to do a get request twice in PHP?, When doing this you overwrite the $header variable. You should maybe have another name that makes more sense for the second header you  To the user it may seem to be one page, but to PHP, it's two completely separate requests. Whatever code you're using to load the Book on the main page cannot magically tell the AJAX script what to load.

You could also put the 2 headers together in one array and later call them twice as :

\Drupal::logger("cam")->debug('PageNameHere retrieveNEWAPINameHere REQUEST: '.json_encode($header));
        $filterPhone = MAPClient2::req( 'get', $context, $header[0], NULL);

\Drupal::logger("cam")->debug('PageNameHere retrieveNEWAPINameHere REQUEST: '.json_encode($header));
        $filterPhone = MAPClient2::req( 'get', $context, $header[1], NULL);

But you don't win much though, but might be more convenient later when you want to add more headers.

Apache sending POST request twice, Apache sending POST request twice · apache-http-server php lamp. I have a e-​commerce shop and I've been noticing that on random  Before you can use the the $_REQUEST variable you have to have a form in html that has the method equal to GET and POST. Then in the php, you can use the $_REQUEST variable to get the data that you wanted. Depending on what you wrote for the method in the form and using $_REQUEST in the php,

$header = [ 
                "configuration": "techDescriptions",
                "automationBu":"<phoneType>",
                "lalaBox":false
                ];

\Drupal::logger("cam")->debug('PageNameHere retrieveNEWAPINameHere REQUEST: '.json_encode($header));
            $filterPhone1 = MAPClient2::req( 'get', $context, $header, NULL);
$header = [ 
                "configuration": "techDescriptions",
                "automationBu":"<phoneType>",
                "lalaBox":treu
                ];

\Drupal::logger("cam")->debug('PageNameHere retrieveNEWAPINameHere REQUEST: '.json_encode($header));
        $filterPhone2 = MAPClient2::req( 'get', $context, $header, NULL);

Just do 2 requests. In your example, you only overwrite the header variable. And I think the in the second header you mean true not treu?

PHP Lab: PHP Double Submit Problem., As we can see in the above figure, the request is ready to be sent again. because we are on success.php and it only makes a GET request to fetch and display  To send GET requests via PHP, there are two different ways to go about doing it. file_get_contents. The first method involves using the function file_get_contents. This easy-to-use function has been present since PHP version 4.3.0 and its purpose is to “read an entire file into a string.” In this case, the file in question is a URL that we

PHP Cookbook: Solutions & Examples for PHP Programmers, "lastName": "Lerdorf" } In REST, the HTTP methods, such as GET and POST, In contrast, making a POST request twice can cause two new resources to be  The PHP $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE. We will discuss $_COOKIE variable when we will explain about cookies. The PHP $_REQUEST variable can be used to get the result from form data sent with both the GET and POST methods. Try out following example by putting the source code in test.php script.

The Book of JavaScript, 2nd Edition: A Practical Guide to , NOTE As inJavaScript, strings in PHP are contained in quotation marks. twice: First, the page is read by the webserver, which executes the PHP code and PHP. with. a. GET. Request. Server-side programs generally take input from a web  In previous tutorials we already looked at the PHP built-in $_GET function and $_POST function. In this tutorial we take a quick look at the PHP built-in $_REQUEST function. In this tutorial we take a quick look at the PHP built-in $_REQUEST function.

My request are called twice, I'm using laravel 5.1, I have a problem with my cURL request, the API is called twice. I tried to execute the same code on a single .php file  PHP $_GET. PHP $_GET is a PHP super global variable which is used to collect form data after submitting an HTML form with method="get". $_GET can also collect data sent in the URL. Assume we have an HTML page that contains a hyperlink with parameters:

Comments
  • wondering how i'll do the response with two requests now? i have this: \Drupal::logger("cam")->debug('PageNameHere retrieveNEWAPINameHere RESPONSE: '.json_encode($filterPhone)); do i make two response as well?
  • wondering how i'll do the response with two requests now? i have this: \Drupal::logger("cam")->debug('PageNameHere retrieveNEWAPINameHere RESPONSE: '.json_encode($filterPhone)); do i make two response as well? @Wkoppel
  • Well as you are sending two different parameters for this then you are excepting two different outcomes. You could have it in one variable though. Create a function which will proccess the $filterPhone, call it after your first call, and after your second call you can do the same with same variable name as you are reassigning its value with response from the call. But I am not quite familiar what you exactly trying to do. Good luck!
  • wondering how i'll do the response with two requests now? i have this: \Drupal::logger("cam")->debug('PageNameHere retrieveNEWAPINameHere RESPONSE: '.json_encode($filterPhone)); do i make two response as well?
  • Yea you can also make 2 responses.
  • Edited my answer.