Author Topic: Nginx Curl Request  (Read 3561 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Nginx Curl Request
« on: June 10, 2020, 03:01:09 PM »
Hi we are using Pro version of CWP

Using NGINX + Php-fpm7.2

We are trying to add new account over API, Our problem is we can do curl request inside the server over bash command, We can do over with "php -r " command all working but doesn't work over Nginx.

Gaves bad gateway 502 error.

Code: [Select]
<?php
$name 
= "test";
$data = array("key" => "KCs6xZUAv6TON49lKdGt0ImcReHX36Snuku43eOD3xRP7",
    
"action" => "add",
    
"user" => $name,
    
"pass" => $name,
    
"email" => $name."@account.com",
    
"package" => "default",
    
"lang" => "en",
    
"inode" => "0",
    
"limit_nproc" => "40",
    
"domain" => $name.".test.com",
    
"limit_nofile" => "150",
    
"server_ips" => "3.14.124.220");
//print_r($data);
$url = "https://server.test.com.tr:2304/v1/account";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
print_r($response);
curl_close($ch);

Any Ideas we are stucked.