我可以使用下面的表格使用卷曲
<form action="http://myserviceprovider/myname/server.php" method="post">
<input type="hidden" value="MyUsername" name="user" />
<input type="hidden" value="MyPassword" name="pass" />
<input type="hidden" value="MyKey" name="sid" />
<input type="hidden" value="12345678" name="sms[0][0]" />
<input type="hidden" value="MyFrist SMS Text" name="sms[0][1]" />
<input type="hidden" value="97654321" name="sms[1][0]" />
<input type="hidden" value="MySecond SMS Text" name="sms[1][1]" />
<input type="submit" />
</form>
现在我试图发送使用PHP卷曲手机短信发送短信发送POST数据到一个API。我创建了包含手机号码与信息的数组:
$sms =array(
array("0" => "12345678", "1" => "MyFrist SMS Text"),
array("0" => "97654321", "1" => "MySecond SMS Text")
);
问题是我无法弄清楚究竟是如何使用下列
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
curl_exec($ch);
发送包括用户名,密码和的myKey值你能请告诉如何解决这个问题?
你一定要明白,他们有一定的规范,我想没有人能猜到他们正在请求的数据? – 2013-04-04 16:39:47
你不需要使用http_build_query()。 curl可以直接接受一个数组。无论如何,你正在构建$ sms数组,如果上面的表单是应该如何提交的。 – 2013-04-04 16:41:08