NOTE: How to use basic authorization in PHP curl Does not work for me.
$password = 'root';         
$username = 'password';
$URL='http://127.0.0.1';   //Curl into own machine local ip is needed.
$port = 7777;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$URL);
curl_setopt($ch, CURLOPT_PORT, $port);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result=curl_exec($ch);
if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); }
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);   
curl_close ($ch);
echo "<br>";
var_dump($result);
echo "<br>";
var_dump($status_code);
Below is my error
Error:
bool(false)
int(0)
Below are my netstats. Port is open and listening.
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:7777          0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN           
PHP7, PHP-CURL & CURL are installed on linux Fedora 27. Webserver type Apache 2.4 
Trying to Curl into Electrum