Re: Socket communications question

From: Date: Sat, 14 Oct 2006 01:17:00 +0000
Subject: Re: Socket communications question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-243119@lists.php.net to get a copy of this message
Hello, on 10/13/2006 01:15 PM Jeff Lanzarotta said the following: > I am trying to get a php web page to communicate with a java > application with little success... > > I can get the php page to send the request to the java application, > just fine. But when the java app sends the response back, the php page > does not seem to get it... > > As a side note, the java app works just fine if the client is another > java app, or a C app. Everything is send and received just fine... > > From what I can tell in the php page, the > > while ($out = socket_read($socket, 2048, PHP_NORMAL_READ)) > { > echo $out; > } > > never returns. > > Any ideas? If all you want to is to fetch a page via the GET method, you can use either fopen/fread or file_get_contents functions passing the URL as file name. If what you want is a more complicated HTTP request like using the POST methods, submit forms, handle cookies and redirection, HTTP authentication, etc.., you may also want to take a look at this HTTP client class: http://www.phpclasses.org/httpclient -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/

« previous php.general (#243119) next »