Jump to content

WordPress - cURL and Resource id #34


Tripodkid

Recommended Posts

Hi there!

I’m building a WordPress site which connects to remote server to populate iframes on various pages of my site. My site connects to the remote server using a PHP code snippet. The code was working but now $curl stopped working and echos Resource id #34. I am not aware of any changes to my site and I have tried identifying the culprit by deactivating my plugins without success.  Furthermore, my webhost doesn’t seem to have much of an idea about the cause and there doesn’t seem to be much info on the web.

var_export($response); returns "false"
var_export($err); returns ''

Any help would be really appreciated! Thanks in advance!

My code is below:

$curl = curl_init();
        curl_setopt_array($curl, array(
        CURLOPT_URL => "https://api.domo.com/oauth/token? 
        grant_type=client_credentials&scope=data%20user%20dashboard",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "GET",
        CURLOPT_POSTFIELDS => "",
        CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
        CURLOPT_USERPWD => "$clientid:$secret"
        ));
        $response = curl_exec($curl);
        $err = curl_error($curl);
var_export($response);
var_export($err);
        curl_close($curl);

 

Link to comment
Share on other sites

"Resource id #X" means you have code that is trying to echo a resource - that's a type of value, like strings and integers and arrays are.

Two things:

1. Code doesn't just randomly start behaving differently. What changed recently?
2. "Resource id #34" has to be coming from somewhere. If it's not those two var_exports then where is it?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.