#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2010
    Posts
    6
    Rep Power
    0

    Question Problem with fwrite()


    I'm new to PHP and i taken a few examples to start with and build this script but a problem came um with fwrite() and i don't know how to fix it :/

    Can anyone here view and inform how to fix it?

    The error is the following:
    fwrite() expects parameter 2 to be string, resource given in

    PHP Code:
    ... 
    $ch curl_init(); 
    curl_setopt($chCURLOPT_URL,"http://$user_ip:81"); 
    curl_setopt($chCURLOPT_HEADER1); 
    curl_setopt($chCURLOPT_RETURNTRANSFER1); 
    $server_output curl_exec ($ch); 
    curl_close ($ch); 

    $ourFileName "$user_ip"
    $ourFileHandle fopen($ourFileName'w') or die("can't open file"); 
    fwrite($ourFileHandle$ch); 
    fclose($ourFileHandle); 
    ?> 
  2. #2
  3. Maddening Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,495
    Rep Power
    9645
    speaking of facepalming...

    You can't run away from me.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2010
    Posts
    6
    Rep Power
    0
    Doesn't matter the problem is fixed with or without your help.
  6. #4
  7. Maddening Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,495
    Rep Power
    9645
    If you think I didn't help you then that explains why it was so difficult for you to figure it out.

    So you finally understood which variable you're supposed to use? Great.

IMN logo majestic logo threadwatch logo seochat tools logo