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

// 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
欢送学习交换

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理