curl_init() has been disabled for security reasons

14,159

Solution 1

If you are on xampp look below

How to enable curl in xampp?

you should only need to change this php

C:\Program Files\xampp\php\php.ini

Solution 2

From your php.ini remove those above functions from disable_functions.

How to locate the php.ini file (xampp)

php.ini file is available in xamp folder

Solution 3

Contact your hosting! :)

Or try:

file_get_contents('http://api.stackoverflow.com/1.1/search?tagged=php');
// Most likely it's also blocked.

You can also try to download with streams.

Or use sockets and connect directly to server and send a HTTP request and parse the response yourself.

There are ways, don't know if they work on your setup... if cURL is not available.

Share:
14,159

Related videos on Youtube

jsduniya
Author by

jsduniya

I love coding..!! just need ready made code to modify and make it better...!! favorite tags => JavaScript Jquery Mysql(Michael Widenius) AngularJs 1.x & 2 NodeJS RequireJS HTML5 and CSS3 Sinon Chai Karma knockoutjs Js webdriver Requirejs saveidea

Updated on September 17, 2022

Comments

  • jsduniya
    jsduniya over 1 year
    $url= "http://api.stackoverflow.com/1.1/search?tagged=php";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_ENCODING, ""); // this will handle gzip content
    $result = curl_exec($ch);
    curl_close($ch);
    print $result;
    

    Error

    Warning: curl_init() has been disabled for security reasons on line 2
    
    Warning: curl_setopt() has been disabled for security reasons on line 3
    
    Warning: curl_setopt() has been disabled for security reasons on line 4
    
    Warning: curl_setopt() has been disabled for security reasons on line 5
    
    Warning: curl_setopt() has been disabled for security reasons on line 6
    
    Warning: curl_exec() has been disabled for security reasons on line 7
    
    Warning: curl_close() has been disabled for security reasons on line 8
    

    May i Know the reason why my Curl not working ?