Log in

No account? Create an account
LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

I cannot to send any request (PHP) [Jun. 4th, 2006|02:37 pm]
LiveJournal Client Discussions



I copy this code from: http://www.livejournal.com/developer/embedding.bml?method=php

$fp = fsockopen("www.livejournal.com", 80, &$errno, &$errstr, 30);
if($fp) {
fputs($fp,"GET /\n\n");
while(!feof($fp)) {
echo fgets($fp,128);

But when I open page, it opens too long time and don't open.

I try to write:

$fp = fsockopen("www.microsoft.com", 80, &$errno, &$errstr, 30);

and all OK!

What the trouble with www.livejournal.com server?

[User Picture]From: xb95
2006-06-04 05:51 pm (UTC)
That's because you're talking HTTP 0.9. We don't support that. Use version 1.0 of the protocol. After all, 1.0 came out about 10 years ago, I think it's pretty standard at this point.
(Reply) (Thread)
[User Picture]From: dilesoft
2006-06-04 05:56 pm (UTC)
I found the errors:

1. No 'host' operand.
2. spaces and line ends send to server too.

Really work this:
$fp = fsockopen("www.livejournal.com", 80, &$errno, &$errstr, 30);
if($fp) {
fwrite($fp,"GET / HTTP/1.1\r\n".
."Host: www.livejournal.com\r\n"
while(!feof($fp)) {
echo fread($fp,128);
(Reply) (Parent) (Thread)