• Resolved yooidje

    (@yooidje)


    Hello WordPress!

    I’am trying to make a plugin for WordPress. This plugin is based on a script that was before running on its own. Now I am trying to include this script to make it a plugin.

    Now everything is working except a function where i’am using cURL. I get the following error:

    Warning: curl_setopt(): supplied argument is not a valid cURL handle resource in /home/*******.php on line 16
    and the lines after this.

    This is the code:

    $ch = curl_init();
    
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
      curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_POST, 1);   
    
      $postdata=array(
        "name" => $Mail,
        "pass" => $Wachtwoord,
        "form_id" => "user_login",
        "op" => "Log in",
      );   
    
      curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);   
    
      $result=curl_exec($ch);

    So the works fine outside of WordPress but including it in a plugin does not work.

    Can anybody help me?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘CURL not working correct by including script’ is closed to new replies.