PHP 发送 POST 值到任意 url
以下方法可以实现将 POST 值发送到 url,并获取返回值
$url = 'http://www.someurl.com'; $myvars = 'myvar1=' . $myvar1 . '&myvar2=' . $myvar2; $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_POST, 1); curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt( $ch, CURLOPT_HEADER, 0); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec( $ch );
https://stackoverflow.com/questions/3080146/post-data-to-a-url-in-php