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

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -