Author Topic: Nginx Curl Request  (Read 2745 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($chCURLOPT_URL$url);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_CUSTOMREQUEST"POST");
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt($chCURLOPT_POSTFIELDShttp_build_query($data));
curl_setopt($chCURLOPT_POST1);
$response curl_exec($ch);
print_r($response);
curl_close($ch);

Any Ideas we are stucked.