2014-10-08 111 views
0

所以我需要在我的PHP中创建一个Curl脚本,我很困惑我不知道那么多Curl(因为我只知道如何复制和粘贴并跨过我的手指)。curl命令到PHP脚本

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); 

,所以我需要知道在哪里key-of-power去,所以我的卷曲可以通过。

预先感谢!!

回答

1

curl_setopt($ch, CURLOPT_USERNAME, "$username")会做到这一点。更多细节是here

+0

非常感谢,恨人们如何盲目投票-_- – user3750649 2014-10-08 03:13:46