• 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

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

How do I enable error reporting in Laravel?

Error converting docx to pdf using Unoconv

Cross-Origin Resource Sharing (CORS) witth Laravel and Vuejs

PHP Startup Unable to load dynamic library /usr/lib/php/20151012/php_mysqli.dll

Wordpress how to get the post thumbnail inside a figure tag

Artisan, creating tables in database

Return multiple values from a function using mysqli_fetch_assoc [closed]

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

Log file is not being written in Laravel 5.5

Inserting Country Selection into MySQL PHP [duplicate]

Project structure for PHP

Unable to match results of php hash_hmac() and coldfusion hmac()

Limit WooCommerce products in cart only from one custom taxonomy

Laravel no logout option from menu after successfull login

About Contact Privacy policy Terms and conditions