dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Proplem with fwrite()

  1. #1
    Join Date
    Jul 2013
    Posts
    26

    Question Proplem 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);
    ?> 
    Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,236
    You want to use $server_output as the second argument (not the cURL handle).
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Jul 2013
    Posts
    26
    Thanks

  4. #4
    Me too, thanks

    **URL REMOVED **
    Last edited by \\.\; 08-28-2017 at 08:54 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center