Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Curl命令转换为PHP脚本_Php_Curl - Fatal编程技术网

将Curl命令转换为PHP脚本

将Curl命令转换为PHP脚本,php,curl,Php,Curl,所以我需要在我的PHP中创建一个Curl脚本,我很困惑,我不知道有多少Curl(就像我只知道如何复制、粘贴和交叉手指一样) Curl命令是 curl https://website.com/v1/route -u key-of-power 到目前为止我有 $ch = curl_init(); curl_setopt ( $ch, CURLOPT_URL, https://website.com/v1/route);

所以我需要在我的PHP中创建一个Curl脚本,我很困惑,我不知道有多少Curl(就像我只知道如何复制、粘贴和交叉手指一样)

Curl命令是

curl https://website.com/v1/route -u key-of-power
到目前为止我有

                $ch = curl_init();
                curl_setopt ( $ch, CURLOPT_URL, https://website.com/v1/route);
                curl_setopt ( $ch, CURLOPT_POST, 1 );
                curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt ($ch, CURLOPT_TIMEOUT, 30);
                $payment_response = curl_exec ($ch);
                curl_close ($ch);
所以我需要知道力量的钥匙在哪里,这样我的卷发才能通过


提前感谢

curl\u setopt($ch,CURLOPT\u USERNAME,$USERNAME”)
就可以了。更详细的是。

你太棒了,谢谢,讨厌人们盲目地否决投票-_-