Last active
March 14, 2023 23:39
-
-
Save nathanielks/10927893 to your computer and use it in GitHub Desktop.
Script used to redirect webhook request from localhost to a local domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Props to goddva: http://stackoverflow.com/questions/1361169/possible-to-add-data-to-the-body-of-a-http-request-using-curl-in-php | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "http://site.dev/webhooks.php?type=stripe"); | |
curl_setopt($ch, CURLOPT_USERAGENT, "My user agent"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_HEADER, 1); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents('php://input') ); | |
$output = curl_exec($ch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment