Php Slim v3如何向不同的URL/Ip地址发送响应?
我尝试用slim实现paypal IPN 他们使用curl向URL发出post请求。不可能只更改slim响应对象中的URL吗 向具有slim的某处发送请求的其他方法 编辑 我说的是这一行:Php Slim v3如何向不同的URL/Ip地址发送响应?,php,slim,Php,Slim,我尝试用slim实现paypal IPN 他们使用curl向URL发出post请求。不可能只更改slim响应对象中的URL吗 向具有slim的某处发送请求的其他方法 编辑 我说的是这一行: $res=curl\u exec($ch) 向某个url发送请求的等效方法是什么?您可以在的帮助下发送PSR7请求 您必须创建一些适配器类来告诉HTTPlug如何创建Slims请求和响应对象。在您的代码中,您只需创建Slim请求并使用此命令调用客户端。您可以在一些客户端之间进行选择,例如Curl或Socke
$res=curl\u exec($ch)代码>
向某个url发送请求的等效方法是什么?您可以在的帮助下发送PSR7请求
您必须创建一些适配器类来告诉HTTPlug如何创建Slims请求和响应对象。在您的代码中,您只需创建Slim请求并使用此命令调用客户端。您可以在一些客户端之间进行选择,例如Curl或Socket。您可以在的帮助下发送PSR7请求
您必须创建一些适配器类来告诉HTTPlug如何创建Slims请求和响应对象。在您的代码中,您只需创建Slim请求并使用此命令调用客户端。您可以在一些客户端之间进行选择,例如Curl或Socket。如果您想将用户发送到PayPal以便他们付款,那么您需要在网站上创建一个表单,直接发布到PayPal
您链接到的代码是PayPal发回服务器的POST请求。要在Slim中处理此问题,请创建post
route:
$app->post('/paypal-ipn', PayPalIpnAction::class);
在Action类中,您需要将POST请求发送回PayPal:
class PayPalIpnAction
{
public function __invoke($request, $response, $args)
{
$dataFromPaypal = $reqest->getParsedBody();
// Validate data from PayPal using HTTPlug, Guzzle or
// you use can the PayPal example code directly.
// If data is valid, process data and do whatever you
// need to with it.
// All done. Return the response.
return $response;
}
}
请注意,返回到PayPal的验证步骤与Slim中通知的处理没有直接关系,因为它是处理通知代码的一部分。如果您想将用户发送到PayPal以便他们付款,那么您需要在网站上创建一个表单,直接发布到PayPal
您链接到的代码是PayPal发回服务器的POST请求。要在Slim中处理此问题,请创建post
route:
$app->post('/paypal-ipn', PayPalIpnAction::class);
在Action类中,您需要将POST请求发送回PayPal:
class PayPalIpnAction
{
public function __invoke($request, $response, $args)
{
$dataFromPaypal = $reqest->getParsedBody();
// Validate data from PayPal using HTTPlug, Guzzle or
// you use can the PayPal example code directly.
// If data is valid, process data and do whatever you
// need to with it.
// All done. Return the response.
return $response;
}
}
请注意,返回PayPal的验证步骤与Slim中通知的处理没有直接关系,因为它是处理通知代码的一部分。我澄清了我的问题我澄清了我的问题