You are trying to open a socket in a file on a remote host, which is incorrect. You can make a socket connection (TCP / UDP) with the port number on the remote host. so your code should look like this:
fsockopen('www.mysite.com', 80);
If you are trying to create a file pointer resource in a remote file, you can use the fopen () function. but for this you also need to specify the application protocol.
PHP provides default stream fairings for a URL file. based on the URL scheme, the corresponding stream wrapper will be called internally. The URL you are trying to open does not have a valid scheme for this solution. make sure it has a scheme like "http: //" or "ftp: //".
so the code will look like this:
$fp = fopen('http://www.mysite.com/path/file.txt');
Also, I donβt think that the HTTP stream fairing (which handles actions in file resources by URL using the http scheme) supports data writing. you can use fread () to read the contents of the url via HTTP, but I'm not sure about the spelling.
EDIT: from the comments and other answers, I realized that you would want to send an HTTP request to the specified URL. The methods described in this answer are for when you want to receive data from a remote URL. if you want to send data, you can use http_request () for this.
farzad Apr 18 2018-10-18T00: 00Z
source share