小编Dex*_*lan的帖子

用Windows中的cURL调用php

目前我在尝试使用Azure作为SMTP服务器时遇到问题.我正在尝试创建一个简单的联系表单,当您点击发送时会发送一封电子邮件.PHP代码很简单,可以在以前的项目中使用另一台服务器,但我现在需要使用Microsoft Azure服务器,根据我的阅读,我需要使用cURL或sendmail API调用.有谁知道如何做到这一点,因为我似乎无法让它工作.这是微软称你需要用来使cURL工作的代码,

// Generate curl request
 $session = curl_init($request);

 // Tell curl to use HTTP POST
 curl_setopt ($session, CURLOPT_POST, true);

 // Tell curl that this is the body of the POST
 curl_setopt ($session, CURLOPT_POSTFIELDS, $params);

// Tell curl not to return headers, but do return the response
 curl_setopt($session, CURLOPT_HEADER, false);
 curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

 // obtain response
 $response = curl_exec($session);
 curl_close($session);

 // print everything out
 print_r($response);
Run Code Online (Sandbox Code Playgroud)

我想这比我看到的要简单得多,但是我在哪里把我的php代码放在这个cURL代码中才能让它工作?在天蓝色的一面,我还有什么其他的东西吗?我已经在我的帐户上安装了sendmail,这就是他们说我需要的全部内容.

如果它有帮助,这里是我的PHP代码

$url = 'https://api.sendgrid.com/';
 $user = 'azure_0386579c9@azure.com';
 $pass = 'password7'; 

 $params = array( …
Run Code Online (Sandbox Code Playgroud)

php curl azure

6
推荐指数
1
解决办法
2569
查看次数

标签 统计

azure ×1

curl ×1

php ×1