关于php:PHP-发送POST数据到指定地址

4次阅读

共计 536 个字符,预计需要花费 2 分钟才能阅读完成。

// POST
function send_post($url, $post_data) {$postdata = http_build_query($post_data);
  $options = array(
    'http' => array(
      'method' => 'POST',
      'header' => 'Content-type:application/x-www-form-urlencoded',
      'content' => $postdata,
      'timeout' => 15 * 60 // 超时工夫(单位:s))
  );
  $context = stream_context_create($options);
  $result = file_get_contents($url, false, $context);
  return $result;
};
 // 发 POST
$arr= array(
    '集体领取' => 'https://pay.apppay.shop/?sf',
    'payType' => '类型',
    'price' =>‘金额’,
    'orderNumber' => '订单号'
);
send_post(https://pay.apppay.shop/?sf, $arr);

作者:小小书童
网站:https://pay.apppay.shop/?sf
欢送学习交换

正文完
 0