facebook / facebook-php-business-sdk

PHP SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
836 stars 519 forks source link

curl_setopt_array(): supplied argument is not a valid cURL handle resource AbstractCurl.php #126

Closed chicag0 closed 9 years ago

chicag0 commented 9 years ago

When doing $adSet->getInsights() about 50% of the time I get an error:

curl_setopt_array(): supplied argument is not a valid cURL handle resource AbstractCurl.php on Line 109

If I keep refreshing the page, it will eventually return the data. I am able to grab data from the API many other places but seem to run into this issue often. Any idea what might be causing?

pruno commented 9 years ago

@chicag0,

which version of PHP are you running? The SDK runs 2 different encapsulations for curl 5.4 and 5.5+

https://github.com/facebook/facebook-php-ads-sdk/tree/master/src/FacebookAds/Http/Adapter/Curl

Are you using Implicit Fetching on cursors? https://github.com/facebook/facebook-php-ads-sdk#implicit-fetching

chicag0 commented 9 years ago

I'm using 5.6.7.

I've just tried with implicit fetching and the issue is still there. I must be doing something else wrong.

All I'm trying to do is get ad insights for a single ad set. Is there a way to do that without using cursors?

pruno commented 9 years ago

not really, but cursors are not the issue here. Can you tell whether this happens for the first request in the script or a succeeding one?

chicag0 commented 9 years ago

Here is a stack trace, if you see anything obvious?

I'll dig in a little deeper and see if I can tell where it is happening.

chicag0 commented 9 years ago

Actually, I went back and used setUseImplicitFetch(true) when fetching the adsets themselves, and my issue is gone! Thanks, I just need to make sure I am always including that. I Appreciate your help