Daniel,

Looking through your code there are a number of bugs.

1) In order for /r/n to be interpolated properly in your header you must use double-quoted strings. Currently you are sending a single line with the chars /r/n.

2) Line 15 needs to match the host in config with a colon before port number. I.e. "Host: localhost:5984"

3) line 18 should use "!==" not "!=".

4) you are not closing your socket - which although it wont break, is a bad habit.

This will work with these changes however pure socket programming is a bit more complex than your considering. For one thing in your code the socket will not close right away which is why you see such a long delay.

Even once the data is retrieved this is still an issue. This is probably due to blocking on the open socket and waiting for the socket to timeout.

Then again couch may not be sending a proper EOF, so who knows.

Strongly recommend you use cURL, context streams or just refer to an existing REST library for Couch in PHP.

HTH,
Jim

On Oct 22, 2009, at 10:49 PM, Daniel Brüggemann <[email protected]> wrote:

These are the last line at my error log:
http://nopaste.info/9c250f5f77.html

http://localhost:5984/ and http://localhost:5984/_all_dbs
Are run and do what they should do.

On Thu, 22 Oct 2009 22:31:44 -0700, Nadav Samet <[email protected]>
wrote:
On Thu, Oct 22, 2009 at 10:17 PM, Daniel Brüggemann <[email protected]>
wrote:

Where can i find the error logs?

Depends on your installation, but on a *nix it is likely to be under one
of
the var/log directories (i.e. /usr/local/var/log, /var/log, etc)

You can verify that couchdb is running by following
http://localhost:5984/
and
http://localhost:5984/_all_dbs assuming that the browser is running on
the
same machine that runs couchdb.





I start the script, then, it take some time, after that,
this is the result:

GET /_all_dbs HTTP/1.1\r\nHOST: locahost\r\nContent-Type: text/ plain;
charset=utf-8\r\n\r\n

Array
(
  [0] =>
)

I located the problem between the lines 51 and 54.
When i comment the passage, the script is running.

On Thu, 22 Oct 2009 20:39:07 -0700, Jim Kass <[email protected]>
wrote:
I recommend using context streams or curl.

Btw, what result are you getting?

Jim

Sent from my iPhone

On Oct 22, 2009, at 8:28 PM, Paul Davis <[email protected] >
wrote:

On Thu, Oct 22, 2009 at 11:18 PM, Daniel Brüggemann <d...@barf ooz.de>
wrote:
Hi,

i try to replicate the code from this site:
http://wiki.apache.org/couchdb/Getting_started_with_PHP
in my own words.
But there is not the result, i hope to get.

http://nopaste.info/2b89f3eab7.html
This is the Code. What am i doing wrong?


Daniel,

Can you paste any errors from the CouchDB logs that you're getting?
Or
the HTTP response? I'm not overly familiar with PHP so an error
message might help pinpoint the issue.

Paul Davis

Reply via email to