Skip to content

Instantly share code, notes, and snippets.

@Shakil-Shahadat
Last active June 28, 2025 05:18
Show Gist options
  • Save Shakil-Shahadat/f52e12a8d5c26c0437857a5a45576f87 to your computer and use it in GitHub Desktop.
Save Shakil-Shahadat/f52e12a8d5c26c0437857a5a45576f87 to your computer and use it in GitHub Desktop.
✓ GET Request by Fetch
<?php
header( 'Access-Control-Allow-Origin: *' );
echo 'Hello World!';
// Ref: https://www.php.net/manual/en/reserved.variables.post.php#125651
fetch( 'get.php' )
.then( response => response.text() )
.then( data => console.log( data ) )
.catch( error => console.error( 'Error:', error ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment