I have been working on a facebook application which uses facebook graph API for authentication, recently facebook upgraded to IPv6 and my network does'nt support IPv6 so all of my calls started returning Host is unreachable error, I searched on facebook bugs and found that we can still use force the requests to facebook to use IPv4 using CURL CURLOPT_IPRESOLVE.
Now when I try to send request to Facebook Graph API using curl I get
Notice: Use of undefined constant CURLOPT_IPRESOLVE - assumed 'CURLOPT_IPRESOLVE'
I want to know how can I enable support for this constant or how can I disable IPv6 support in php so that I can send request to Facebook Graph API using IPv4.
My code is
$url = ("https://graph.facebook.com/me/access_token?tokrn");
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$contents = curl_exec($c);
$err = curl_getinfo($c,CURLINFO_HTTP_CODE);
curl_close($c);
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…