Results 1 to 6 of 6

Thread: HTTP: failed socket_read

  1. #1
    Join Date
    Dec 2008
    Posts
    33

    HTTP: failed socket_read

    hi
    I use for some time a script to send / receive HTTP requests (socket_create, conenct, write, etc ...) to the stage of reading:

    $ reception ='';
    while ($ buffer = socket_read ($ socket, 2000)) (
    $ reception .= $ buff;
    )

    So far it worked , but when trying the script with facebook ,10minutes before gives me the warning:

    <b> Warning </ b>: socket_read () [<a href='function.socket-read'> function.socket-read </ a>]: unable to read from socket [104]:

    Connection reset by peer
    Basically I feel that my script does not understand that there's nothing to read.
    Someone has a any idea?

  2. #2
    Join Date
    Dec 2008
    Posts
    207

    Re: HTTP: failed socket_read

    hi
    as i read your problem first thing in my mind is " why not make a url fopen on your remote? Php will handle all "
    what say ?

  3. #3
    Join Date
    Dec 2008
    Posts
    33

    Re: HTTP: failed socket_read

    hi
    Your question is fine . But it does not seem to me that fopen can send GET / POST, outside what is looking for ..

  4. #4
    Join Date
    Dec 2008
    Posts
    207

    Re: HTTP: failed socket_read

    can use a context...

    Found in the comments on [Link] :
    <?php
    $data = array ( 'foo' => 'bar' , 'bar' => 'baz' );
    $data = http_build_query ( $data );

    $context_options = array (
    'http' => array (
    'method' => 'POST' ,
    'header' => "Content-type: application/x-www-form-urlencoded\r\n"
    . "Content-Length: " . strlen ( $data ) . "\r\n" ,
    'content' => $data
    )
    );

    $context = context_create_stream ( $context_options )
    $fp = fopen ( 'https://url' , 'r' , false , $context );
    ?>

  5. #5
    Join Date
    Dec 2008
    Posts
    207

    Re: HTTP: failed socket_read

    ok

    First I scrutinizes each packet received to detect the presence of the </ html> to close the loop myself, without waiting for the server to tell me that it's over.

    I needed to access a secure page (https), and failing with sockets that I chose my fsockopen () (this feature had the same concern receiving end, but with the previous hack it works)

    I will still try fopen.....

  6. #6
    Join Date
    Dec 2008
    Posts
    196

    Re: HTTP: failed socket_read

    hi
    ope fully this might helps you !!!
    http://in.php.net/socket_create_pair
    try

Similar Threads

  1. How to resolve HTTP error Precondition Failed error message?
    By Bengal Tiger in forum Networking & Security
    Replies: 3
    Last Post: 06-04-2012, 01:33 AM
  2. How to fix HTTP error 307 Temporary Redirect (since HTTP/1.1)?
    By Charu Sharma in forum Networking & Security
    Replies: 6
    Last Post: 05-04-2012, 01:14 AM
  3. HTTP: 12029 no HTTP access for IE
    By Captainlumpy in forum Windows XP Support
    Replies: 5
    Last Post: 29-07-2010, 06:43 AM
  4. Replies: 4
    Last Post: 05-11-2009, 11:54 PM
  5. Failed to open stream: HTTP request failed
    By Jayden in forum Technology & Internet
    Replies: 3
    Last Post: 04-08-2009, 12:49 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,583,650.67679 seconds with 16 queries