卷曲请求 - 我怎么办呢? [英] cURL Request - how do I do it?
本文介绍了卷曲请求 - 我怎么办呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可有人请点我在正确的方向如何我可能会使用以下内容:
Can somebody please point me in the right direction how I might use the following:
curl "https://api.xxxxxx.com/phones/:number/calls" \
-d"call[phone_number]=<number-to-call>" \
-d"token=<api_token>" \
--insecure
我试图找到答案,但我似乎无法得到任何东西为我工作 - 它应该打个电话铃声!理论上!但无法找到发送与PHP请求的方式。
I have tried to find the answer, but I just cannot seem to get anything working for me - it should make a phone ring!!! in theory! But cannot find a way of sending the request with PHP.
谢谢,
B点。
Thanks, B.
推荐答案
像这样使用PHP的的卷曲:
Something like this using PHP's cURL:
<?php
$ch = curl_init();
$data = array(
'call[phone_number]' => '<number-to-call>',
'token' => '<api_token>'
);
curl_setopt($ch, CURLOPT_URL, 'https://api.xxxxxx.com/phones/:number/calls');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_exec($ch);
?>
这篇关于卷曲请求 - 我怎么办呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文