我想发送POST请求到https服务器。如何使用drupal_http_request构建https POST请求?
$data = 'name=value&name1=value1';
$options = array(
'method' => 'POST',
'data' => $data,
'timeout' => 15,
'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
);
$result = drupal_http_request('http://somewhere.com', $options);
我不能找出出实现在上面的例子POST码https的选项。
任何人都可以请解释我如何做到这一点?我对使用Drupal的PHP编码很陌生,我完全可以使用这些指导。
我发现所有需要的是将其设置在协议中。所以我得到了这个代码。
$data = 'access_token=455754hhnaI&href=fb&template=You have people waiting to play with you, play now!';
$options = array(
'method' => 'POST',
'data' => $data,
'timeout' => 15,
'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
);
$result = drupal_http_request('https://graph.facebook.com/1000721/notifications?', $options);
它仍然不起作用。如果我通过Firefox发布https://graph.facebook.com/1000080521/notifications?access_token=45575FpHfhnaI&href=fb&template=You have people waiting to play with you, play now!
它的作品。
我可能没有在Drupal中正确构建请求。
我在做什么错?我如何让我的代码工作?
非常感谢!真的很感谢你的详细解答! – BLV