stephenbrooks.orgForumOtherProgramsPHP proxy-server question ?
Username: Password:
Search site:
Subscribe to thread via RSS
Goner
2002-11-11 01:38:02
hi,

seeing that there are several people here who program PHP ; is there a way to get the 'contents' (ie as displayed in a browser) of a web-site with PHP running behind a proxyserver ?? 
i know about file(), but that doesn't work from behind a proxy ...

Goner (php-newbie)
Stephen Brooks
2002-11-11 03:42:04
Opaque proxy servers suck.  razz

The best way is (as you said)
<?php echo implode('',file($url)); ?>
to display the HTML contents of a webpage.  What exactly does the proxy server prevent you from doing?  $in=fsockopen($url,80); returns a file pointer to the server's HTTP socket, so you can write an HTTP command to it and then receive the data that way, I think, although it sounds almost as if it's your URL-resolving that's not working.


"As every 11-year-old kid knows, if you concentrate enough Van-der-Graff generators and expensive special effects in one place, you create a spiral space-time whirly thing, AND an interesting plotline"
Goner
2002-11-11 08:28:37
> Opaque proxy servers suck.  razz

yeah, you mentioned that before ... wink

> What exactly does the proxy server prevent you from doing? 

well, for normal use it works fine and software that allows me to specify a proxy-server works OK too, but PHP just does not let me use the proxy-server, that's the problem ...

> $in=fsockopen($url,80); returns a file pointer to the server's HTTP socket,
> so you can write an HTTP command to it and then receive the data that way,

ok, fsockopen gives me "Resource id #1" ; how do i use that to issue HTTP commands ; with fputs() ?

Goner
Stephen Brooks
2002-11-11 10:04:55
quote:
Originally posted by Goner:
ok, fsockopen gives me "Resource id #1" ; how do i use that to issue HTTP commands ; with fputs() ?


Yes, I think that's how it works.  You can send data to any port on any device like this, so maybe if you know exactly what your proxy does to the packets you could send requests directly to it.  I'm not an expert on this sort of thing though.


"As every 11-year-old kid knows, if you concentrate enough Van-der-Graff generators and expensive special effects in one place, you create a spiral space-time whirly thing, AND an interesting plotline"
: contact : - - -
E-mail: sbstrudel characterstephenbrooks.orgTwitter: stephenjbrooksMastodon: strudel charactersjbstrudel charactermstdn.io RSS feed

Site has had 26639109 accesses.