php - open a socket on a shared host -


i'm trying open socket on host using following code:

$timeout = 10; $s = stream_socket_client('mywebsite.com:80', $errcode, $errstring, $timeout); $message = "get /index.php http/1.0\r\n\r\n"; fwrite($s, $message); while(!feof($s)){     echo fread($s, 1024); } 

nothing fancy, example found. problem every time run code different files. think because host shared one.

is there way overcome problem, is, pull reliably proper file i'm trying get?

thank you.

in http request have specify host you're accessing. noted correctly multiple dns entries can point same ip address.

$message = "get /index.php http/1.1\r\nhost: hostname.com\r\n\r\n"; 

Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

php - Time zone issue -

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -