Ipfs.infura.io refusing connection when using programming language ?!

im trying to to store data to ipfs via php , i use curl to communicate with api
but for some reason ipfs.infura .io is refusing my connection via php
even a simple command like


which you can open in the browser , when i try to open it via php i get

Failed to connect to ipfs.infura. io port 5001: Connection refused

or when using another method like file_get_contents

file_get_contents(ipfs.infura.io:5001/api/v0/pin/add?arg=QmeGAVddnBSnKc1DLE7DLV9uuTqo5F7QbaveTjr45JUdQn): failed to open stream: Connection refused

i’ve tried it on local host and multiple server , i get the same result

any idea why is this happening ?

here is a simplified version n of my code

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL,"https://ipfs.infura.io:5001/api/v0/pin/add?arg=QmeGAVddnBSnKc1DLE7DLV9uuTqo5F7QbaveTjr45JUdQn");
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_FAILONERROR, true);
    $res = curl_exec($curl);
    if (curl_errno($curl)) {
        $error_msg = curl_error($curl);
        echo ('error ...');
        echo ($error_msg);


Hi @M_Z and welcome to our Infura community.

Could you please let me know if the requests you’re sending are using the Basic Authentication header?

You may find the following documentation relevant: IPFS | Infura Documentation