CLI behind proxy

--0016e6464f725bcfac047ec5c27b
Content-Type: text/plain; charset=ISO-8859-1

Hi all,

I want to run fsockopen etc behind a proxy.
proxychains (http://proxychains.sourceforge.net/) may be helpful,
unfortunately the support for that is pretty bad. Please inform me of other
alternatives

KK.

--0016e6464f725bcfac047ec5c27b--
kranthi [ Do, 04 Februar 2010 13:48 ] [ ID #2031311 ]

Re: CLI behind proxy

On 4 February 2010 12:48, kranthi <kranthi117 [at] gmail.com> wrote:
> Hi all,
>
> I want to run fsockopen etc behind a proxy.
> proxychains (http://proxychains.sourceforge.net/) may be helpful,
> unfortunately the support for that is pretty bad. Please inform me of other
> alternatives
>
> KK.
>

I used to use a proxy written in Python which provided the client NTLM
authentication to our ISA server for PHP.

So, PHP script talked to NTLM Authentication Proxy Server which talked
to ISA which talked to the outside world.

Worked fine.

The only thing I needed to do in PHP was setup a default context and
all my normal file_get_contents(),etc. which needed to communicate
through to the outside world worked fine.

Here is the code I used ...

// Define the default, system-wide context.
$r_default_context = stream_context_get_default
(
array
(
'http' => array
( // All HTTP requests are passed through the local NTLM proxy
server on port 8080.
'proxy' => 'tcp://127.0.0.1:8080',
'request_fulluri' => True,
),
)
);

// Though we said system wide, some extensions need a little coaxing.
libxml_set_streams_context($r_default_context);



So, set the proxy tcp address appropriately, put this code in a global
include file (maybe via the auto_prepend_file= ini file setting) and
see how you go.



--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard Quadling [ Do, 04 Februar 2010 14:21 ] [ ID #2031312 ]

Re: CLI behind proxy

--005045016bed5cce52047ec70714
Content-Type: text/plain; charset=ISO-8859-1

I did'nt understand completely. But I noticed that if i do

$opts = array('http' => array('proxy' => 'tcp://10.3.100.212:8080',
'request_fulluri' => true));
$context = stream_context_set_default($opts);

fopen, file_get_contents, etc. are working fine, but fsockopen is not

KK.

--005045016bed5cce52047ec70714--
kranthi [ Do, 04 Februar 2010 15:19 ] [ ID #2031313 ]

Re: CLI behind proxy

On 4 February 2010 14:19, kranthi <kranthi117 [at] gmail.com> wrote:
> fsockopen

What type of socket are you opening?

--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard Quadling [ Do, 04 Februar 2010 15:38 ] [ ID #2031314 ]

Re: CLI behind proxy

On 4 February 2010 14:38, Richard Quadling <rquadling [at] googlemail.com> wrote:
> On 4 February 2010 14:19, kranthi <kranthi117 [at] gmail.com> wrote:
>> fsockopen
>
> What type of socket are you opening?
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>

The code puts HTTP requests through the context.



--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard Quadling [ Do, 04 Februar 2010 15:40 ] [ ID #2031315 ]

Re: CLI behind proxy

stream_socket_client("tcp://talk.google.com:5222")
i m trying to use http://code.google.com/p/xmpphp/ actually

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
kranthi [ Do, 04 Februar 2010 16:27 ] [ ID #2031317 ]

Re: CLI behind proxy

On 4 February 2010 15:27, kranthi <kranthi117 [at] gmail.com> wrote:
> stream_socket_client("tcp://talk.google.com:5222")
> i m trying to use http://code.google.com/p/xmpphp/ actually
>

Does your proxy pass through all requests?

It might be easier to just set you NIC gateway to the proxy.

We stopped using ISA server with NTLM authentication.

Now, the gateway for my machine is the ISA server, so all requests go
through there automatically and we use AD for authentication.



--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Richard Quadling [ Do, 04 Februar 2010 17:38 ] [ ID #2031318 ]
PHP » gmane.comp.php.general » CLI behind proxy

Vorheriges Thema: How to change a filename for download (e.g. jpeg, pdf etc.)
Nächstes Thema: stream_select() not working on regular files?