【发布时间】:2012-12-14 01:46:03
【问题描述】:
我需要一个 php 页面,在加载时自动发送 POST 请求,而无需使用提交按钮或任何用户输入。我不需要对响应做任何事情。
我只需要将“8”发布到 www.mydomain.com
$url = 'http://www.mydomain.com/';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 8);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
我做错了什么?
【问题讨论】: