I have an existing code which is :
$Socket = fsockopen(HOST, PORT);
where $Socket returned here is a resource. However, i need to get it behind a proxy server with Authentication. I am sure it could be done via
public static function returnData($url, $port)
{
$fp = fsockopen(static::$ip, static::$port); // connect to proxy
$login = static::$login;
$passwd = static::$passwd;
fputs($fp, "GET <a href=\"https://$url/\" "
. "title=\"https://$url/\">https://$url/</a> HTTP/1.1\r\n"
. "Host:$url:$port\r\n"
. "Proxy-Authorization: Basic " . base64_encode("$login:$passwd") . "\r\n\r\n");
$data = "";
while (!feof($fp)) $data .= fgets($fp, 64000);
fclose($fp);
return $data;
}
but the function here returns string and not resource.
How can i get the resource returned or how could be resource be retrieved using cURL