php - fsockopen unable to connect error with remote css file -


i'm trying http response headers of images/css/js files used in remote web page.when use

fsockopen('mydomain.com',80,$errsno,$errstr,20)

it works.but when try same css link in webpage, like,

fsockopen('mydomain.com/style.css',80,$errno,$errstr,20)  

it returns error

warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: no such host known warning: fsockopen(): unable connect mydomain.com/style.css 

isn't possible connect remote file css or image files?

but file there in server.i hoping response headers,file size,response time etc.can't way? hint please?

fsockopen() doesn't speak http, you'd have write valid http request socket after opening in first example yourself. minimal form be:

get /style.css http/1.1 host: mydomain.com 

followed empty line.

or use pear http_request2 package if don't want speak raw http:

http://pear.php.net/manual/en/package.http.http-request2.php


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -