robinvdvleuten / php-nntp

Client for communicating with servers throught the Network News Transfer Protocol (NNTP) protocol.
MIT License
39 stars 12 forks source link

Error when I try to connect with the code exemple (Laravel 5) #11

Closed shinigami35 closed 9 years ago

shinigami35 commented 9 years ago

Hi,

My name is Adrien, and I have some problems with your library PHP-NNTP. I am using your library with the framework Laravel 5.

When I use your library, I have the same error all time : 'Invalid response given: response string should be terminated by \r\n'. I do not know why I have this error.

I am using you exemple to connect with the server of php news. I do a copy/paste with your exemple code but I always have this error.

Can you explain me with i have this error all time ?

Regards Adrien.

My code is :


//Code in my controller

/**
**  This is the route when I try to call my function
**  Route::get('/test', 'MainController@index');
**/

public function index()
{
    $connection = new Connection('news.php.net', 119);
    $client = new Client($connection);

    $client->connect();  //Error here 

    $command = $client->overviewFormat();
    $overviewFormat = $command->getResult();

    $command = $client->group('php.doc');
    $group = $command->getResult();

    $command = $client->xover($group['first'], $group['first'] + 100, $overviewFormat);
    $articles = $command->getResult();

    dd($articles); //laravel var_dump and die

    $client->disconnect();
    return false;
}

Best regards

robinvdvleuten commented 9 years ago

Hi Adrien,

Can you give a dump of the buffer where the response is created from on this line? https://github.com/RobinvdVleuten/php-nntp/blob/master/src/Connection/Connection.php#L157

shinigami35 commented 9 years ago

The buffer is empty, I have nothing in and i do not understand why the buffer is empty.

robinvdvleuten commented 9 years ago

Maybe something went wrong with the socket interaction in the Connection class. I can't help you with only this information so you have to try to debug the Connection class yourself.

shinigami35 commented 9 years ago

Ok, I will try to understand, but it is strange that the socket interaction doesn't work.

joedawson commented 8 years ago

I also get the same with the example in the README, @shinigami35 did you manage to resolve this?

Edit Using dev-master rather than ^0.7 resolved me from getting this error.

robinvdvleuten commented 8 years ago

@JoeDawson can you confirm that the issue is fixed in the master branch? Then I can create a new release (0.8) for it.

joedawson commented 8 years ago

Yeah the issue is fixed in the master branch, the code example in the README works 😊

On Tuesday, 20 September 2016, Robin van der Vleuten < notifications@github.com> wrote:

@JoeDawson https://github.com/JoeDawson can you confirm that the issue is fixed in the master branch? Then I can create a new release (0.8) for it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/robinvdvleuten/php-nntp/issues/11#issuecomment-248218167, or mute the thread https://github.com/notifications/unsubscribe-auth/AA9oIAmoXfH5g6t0VAwY26DnyzthuB5yks5qr4K1gaJpZM4Dxdpv .

robinvdvleuten commented 8 years ago

@JoeDawson I've bumped the version to 0.8. If you find any issues please let me know or even better submit a PR to improve the lib 😄

joedawson commented 8 years ago

Working as I hoped @robinvdvleuten 👍