Skip to content

Instantly share code, notes, and snippets.

@easychen
Last active August 2, 2021 04:21
Show Gist options
  • Save easychen/15fe4d957a8353ae005f997c9a2b6e32 to your computer and use it in GitHub Desktop.
Save easychen/15fe4d957a8353ae005f997c9a2b6e32 to your computer and use it in GitHub Desktop.
php post
<?php
function mypost( $url , $data )
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
return $response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment