Skip to content
Advertisement

PHP, cURL request not fetching data

I want to get some informations through github API, i tried to use file_get_contents and it does not seem to work, so i moved to cURL, it does not give an error but it’s not returning anything

PHP code :

JavaScript

I checked the http code with CURLINFO_HTTP_CODE and its set to 0. is there any fix that i can get the json data when requesting.

Advertisement

Answer

I have tried accessing the same URL using curl in php and it seems to work fine. Checkout the following example:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement