• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Detect a fetch request in PHP

phpfetch-api


PHP Snippet 1:

  fetch(url, {
    headers: {
      'credentials': 'same-origin',
      'X-Requested-With': 'XMLHttpRequest',
      'Content-Type': 'application/json'
       // or 'Content-Type': 'application/x-www-form-urlencoded'
    },
    method: 'POST'
  })

Related Snippets

Using spatie/media-library, how to rename a collection of uploaded files?

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Add bold text and line break into Laravel Notification Email

PHP error: "The zip extension and unzip command are both missing, skipping."

Need to display only array value in JSON output

PHP: Insert marker every 3 iterations

Appending data to an anchor tag

WHERE IN array binding in DB::raw laravel 5.4

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

How to display MySQL table using php and edit it in a web browser

Yii2 redirecting to previous page after login

How to fix Call to undefined method AppModelsTableName::factory?

Laravel 5 session not persisting after user is logged in

Magento 2 - Controller returning blank page

The sum of the user's points

About Contact Privacy policy Terms and conditions