1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Resource id #1

Discussion in 'PHP' started by Psychotomus, Mar 24, 2006.

  1. #1
    whats this mean.

    i get this with the following code.


    
    $fp = fsockopen("toc.oscar.aol.com", 5190, $errno, $errstr, 30);
    
    print $fp;
    
    Code (markup):

     
    Psychotomus, Mar 24, 2006 IP
  2. vishwaa

    vishwaa Well-Known Member

    Messages:
    271
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #2
    from php.net
    more details : http://in2.php.net/fsockopen
     
    vishwaa, Mar 24, 2006 IP
  3. sketch

    sketch Well-Known Member

    Messages:
    898
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    148
    #3
    Resource id# usually means it's an array. If you don't know what's in the array, use the following code:

    print_r($whatever_variable);
    Code (markup):
     
    sketch, Mar 26, 2006 IP
  4. vishwaa

    vishwaa Well-Known Member

    Messages:
    271
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #4
    print_r($whatever_variable) - you will get the same 'Resource Id#'.

    fsockopen returns the special variable of data type 'Resource' which is used to hold a reference to an external resource.

    It is not an array/string/object.

    To get the type of $fp, you should use get_resource_type ( $fp )
     
    vishwaa, Mar 27, 2006 IP
  5. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    var_dump($fp) will tell you the type of resource.
     
    szalinski, Mar 26, 2009 IP
  6. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #6
    It means you are trying to print a socket handle, which doesn't make much sense.

    You can read from it, and you can write to it, but you can't just print it. I assume you are trying to do something with AOL's instant messenger protocol. You'll have to read about the protocol and see what to send to the socket before you will receive anything useful.

    To see at least something happen (a 404 message from AOL's server), you can do this:

    $fp = fsockopen("toc.oscar.aol.com", 5190, $errno, $errstr, 30);
    fputs($fp, "GET /\n\n");
    echo fgets($fp, 4000);
    Code (markup):
    That ought to at least give you a sense of how to communicate with it, once you have figured out what you want to say.
     
    SmallPotatoes, Mar 26, 2009 IP