Re: HttpSocket with proxy server

2009-12-15 Thread fr3nch13
Thanks!

I'll try this out and let this group know if it was successful.

On Dec 14, 10:04 pm, gianpaulo gcbasa...@gmail.com wrote:
 Try this:

 $HttpSocket = new HttpSocket();
 $request = $HttpSocket-request(array(
    'host'='proxy server address:proxy server port',
    'uri'='http://api.yahoo.com/'
 ));

 This is how powerful CakePHP is :D

 On Dec 15, 8:48 am, fr3nch13 fr3nc...@gmail.com wrote:



  Has anyone tried using a proxy server with HttpSocket?

  I have been looking all over via the normal channels (google, api,
  bakery, book, etc.) to no avail.

  If so, could you please point me in the right direction?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: HttpSocket with proxy server

2009-12-15 Thread fr3nch13
It doesn't seem to be working.
Any help would be greatly appreciated!

Here is some more information/versions/stats to help:

Server: RHEL, PHP 5.1.6, cakephp 1.2.3.8166
Proxy: Squid/2.5 stable

This is my test shell:
?php

class TesterShell extends Shell
{

function httpsockproxy()
{
$uri = 'http://www.google.com';

if(isset($this-args[0]))
{
$uri = $this-args[0];
}

App::import('Core', 'HttpSocket');
$HttpSocket = new HttpSocket();

$request = $HttpSocket-request(array(
'method' = 'POST',
'host'='[proxyhostname]:[port]',
'uri'='http://www.google.com'
));
print_r($request);
print_r($HttpSocket-config);
}
}

the print_r($request) is getting a response from the squid proxy
server; however, the proxy is returning it's html error instead of
google's homepage:

...
H2The requested URL could not be retrieved/H2
HR noshade size=1px
P
While trying to retrieve the URL:
A HREF=///A
P
The following error was encountered:
UL
LI
STRONG
Invalid URL
/STRONG
/UL


the print_r($HttpSocket-config) output is:
Array
(
[persistent] =
[host] = [proxyhostname]:[port]
[protocol] = 6
[port] = 80
[timeout] = 30
[request] = Array
(
[uri] = Array
(
[scheme] = http
[host] = www.google.com
[port] = 80
)

[auth] = Array
(
[method] = Basic
[user] =
[pass] =
)

[cookies] = Array
(
)

)

)


On Dec 15, 8:56 am, fr3nch13 fr3nc...@gmail.com wrote:
 Thanks!

 I'll try this out and let this group know if it was successful.

 On Dec 14, 10:04 pm, gianpaulo gcbasa...@gmail.com wrote:

  Try this:

  $HttpSocket = new HttpSocket();
  $request = $HttpSocket-request(array(
     'host'='proxy server address:proxy server port',
     'uri'='http://api.yahoo.com/'
  ));

  This is how powerful CakePHP is :D

  On Dec 15, 8:48 am, fr3nch13 fr3nc...@gmail.com wrote:

   Has anyone tried using a proxy server with HttpSocket?

   I have been looking all over via the normal channels (google, api,
   bakery, book, etc.) to no avail.

   If so, could you please point me in the right direction?



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: HttpSocket with proxy server

2009-12-15 Thread fr3nch13
Also, some more information.
1. i don't have access to change anything on the squid proxy.
2. trying with curl works:
curl --proxy [proxyhostname]:[port] http://www.google.com

On Dec 15, 10:18 am, fr3nch13 fr3nc...@gmail.com wrote:
 It doesn't seem to be working.
 Any help would be greatly appreciated!

 Here is some more information/versions/stats to help:

 Server: RHEL, PHP 5.1.6, cakephp 1.2.3.8166
 Proxy: Squid/2.5 stable

 This is my test shell:
 ?php

 class TesterShell extends Shell
 {

         function httpsockproxy()
         {
                 $uri = 'http://www.google.com';

                 if(isset($this-args[0]))
                 {
                         $uri = $this-args[0];
                 }

                 App::import('Core', 'HttpSocket');
                 $HttpSocket = new HttpSocket();

                 $request = $HttpSocket-request(array(
                         'method' = 'POST',
                         'host'='[proxyhostname]:[port]',
                         'uri'='http://www.google.com'
                         ));
                 print_r($request);
                 print_r($HttpSocket-config);
         }

 }

 the print_r($request) is getting a response from the squid proxy
 server; however, the proxy is returning it's html error instead of
 google's homepage:

 ...
 H2The requested URL could not be retrieved/H2
 HR noshade size=1px
 P
 While trying to retrieve the URL:
 A HREF=///A
 P
 The following error was encountered:
 UL
 LI
 STRONG
 Invalid URL
 /STRONG
 /UL
 

 the print_r($HttpSocket-config) output is:
 Array
 (
     [persistent] =
     [host] = [proxyhostname]:[port]
     [protocol] = 6
     [port] = 80
     [timeout] = 30
     [request] = Array
         (
             [uri] = Array
                 (
                     [scheme] = http
                     [host] =www.google.com
                     [port] = 80
                 )

             [auth] = Array
                 (
                     [method] = Basic
                     [user] =
                     [pass] =
                 )

             [cookies] = Array
                 (
                 )

         )

 )

 On Dec 15, 8:56 am, fr3nch13 fr3nc...@gmail.com wrote:

  Thanks!

  I'll try this out and let this group know if it was successful.

  On Dec 14, 10:04 pm, gianpaulo gcbasa...@gmail.com wrote:

   Try this:

   $HttpSocket = new HttpSocket();
   $request = $HttpSocket-request(array(
      'host'='proxy server address:proxy server port',
      'uri'='http://api.yahoo.com/'
   ));

   This is how powerful CakePHP is :D

   On Dec 15, 8:48 am, fr3nch13 fr3nc...@gmail.com wrote:

Has anyone tried using a proxy server with HttpSocket?

I have been looking all over via the normal channels (google, api,
bakery, book, etc.) to no avail.

If so, could you please point me in the right direction?



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: HttpSocket with proxy server

2009-12-15 Thread fr3nch13
I know what gainpaulo post, should be the way it's supposed to work;
however, i was able to get it to work with a GET, but not a POST:


$request_get = array(
'GET http://www.google.com HTTP/1.1',
'Host: www.google.com',
'Connection: close',
'User-Agent: CakePHP'
);
$response = $HttpSocket-request(array(
'host' = $proxyhost:$proxyport,
'line' = implode(\n, $request_get),
'raw' = implode(\n, $request_get),
));
print_r($response);
print_r($HttpSocket-request);
print_r($HttpSocket-config);

$request_post = array(
'POST http://www.google.com HTTP/1.1',
'q=cakephp',
'Host: www.google.com',
'Connection: close',
'User-Agent: CakePHP'
);
$response = $HttpSocket-request(array(
'host' = $proxyhost:$proxyport,
'line' = implode(\n, $request_post),
'raw' = implode(\n, $request_post),
));
print_r($response);
print_r($HttpSocket-request);
print_r($HttpSocket-config);

On Dec 15, 10:21 am, fr3nch13 fr3nc...@gmail.com wrote:
 Also, some more information.
 1. i don't have access to change anything on the squid proxy.
 2. trying with curl works:
     curl --proxy [proxyhostname]:[port]http://www.google.com

 On Dec 15, 10:18 am, fr3nch13 fr3nc...@gmail.com wrote:

  It doesn't seem to be working.
  Any help would be greatly appreciated!

  Here is some more information/versions/stats to help:

  Server: RHEL, PHP 5.1.6, cakephp 1.2.3.8166
  Proxy: Squid/2.5 stable

  This is my test shell:
  ?php

  class TesterShell extends Shell
  {

          function httpsockproxy()
          {
                  $uri = 'http://www.google.com';

                  if(isset($this-args[0]))
                  {
                          $uri = $this-args[0];
                  }

                  App::import('Core', 'HttpSocket');
                  $HttpSocket = new HttpSocket();

                  $request = $HttpSocket-request(array(
                          'method' = 'POST',
                          'host'='[proxyhostname]:[port]',
                          'uri'='http://www.google.com'
                          ));
                  print_r($request);
                  print_r($HttpSocket-config);
          }

  }

  the print_r($request) is getting a response from the squid proxy
  server; however, the proxy is returning it's html error instead of
  google's homepage:

  ...
  H2The requested URL could not be retrieved/H2
  HR noshade size=1px
  P
  While trying to retrieve the URL:
  A HREF=///A
  P
  The following error was encountered:
  UL
  LI
  STRONG
  Invalid URL
  /STRONG
  /UL
  

  the print_r($HttpSocket-config) output is:
  Array
  (
      [persistent] =
      [host] = [proxyhostname]:[port]
      [protocol] = 6
      [port] = 80
      [timeout] = 30
      [request] = Array
          (
              [uri] = Array
                  (
                      [scheme] = http
                      [host] =www.google.com
                      [port] = 80
                  )

              [auth] = Array
                  (
                      [method] = Basic
                      [user] =
                      [pass] =
                  )

              [cookies] = Array
                  (
                  )

          )

  )

  On Dec 15, 8:56 am, fr3nch13 fr3nc...@gmail.com wrote:

   Thanks!

   I'll try this out and let this group know if it was successful.

   On Dec 14, 10:04 pm, gianpaulo gcbasa...@gmail.com wrote:

Try this:

$HttpSocket = new HttpSocket();
$request = $HttpSocket-request(array(
   'host'='proxy server address:proxy server port',
   'uri'='http://api.yahoo.com/'
));

This is how powerful CakePHP is :D

On Dec 15, 8:48 am, fr3nch13 fr3nc...@gmail.com wrote:

 Has anyone tried using a proxy server with HttpSocket?

 I have been looking all over via the normal channels (google, api,
 bakery, book, etc.) to no avail.

 If so, could you please point me in the right direction?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: HttpSocket with proxy server

2009-12-15 Thread fr3nch13
I just tried it with cake 1.2.5 stable, and it's still not working
like how gainpaulo was describing above.

Is this indeed the way it's supposed to be working?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


HttpSocket with proxy server

2009-12-14 Thread fr3nch13
Has anyone tried using a proxy server with HttpSocket?

I have been looking all over via the normal channels (google, api,
bakery, book, etc.) to no avail.

If so, could you please point me in the right direction?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: HttpSocket with proxy server

2009-12-14 Thread gianpaulo
Try this:

$HttpSocket = new HttpSocket();
$request = $HttpSocket-request(array(
   'host'='proxy server address:proxy server port',
   'uri'='http://api.yahoo.com/'
));

This is how powerful CakePHP is :D



On Dec 15, 8:48 am, fr3nch13 fr3nc...@gmail.com wrote:
 Has anyone tried using a proxy server with HttpSocket?

 I have been looking all over via the normal channels (google, api,
 bakery, book, etc.) to no avail.

 If so, could you please point me in the right direction?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


HttpSocket with proxy

2008-09-23 Thread Fahad

hi,

i m working on a API service with cake.
the project is heavily depended upon API calls.

the server is located in Asia, and most of the time the HTTP request
fails.
is there any feature in HttpSocket class that will let me do the API
calls via a proxy?

thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---