How to use cURL within the orders plugin
-
Hello,
Here is the cURL function I am trying to ruin in the wordpress options page for the plugin. It works on the server but not inside of the options page. I have read I need to to 2 cURL functions. One to get admin for wordpress and the other to run the cURL function.
Please instruct me how to do this…
function get_data($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); global $data; $data = curl_exec($ch); curl_close($ch); $info = json_decode($data,true); //decoding the json data global $report; $report = $info; }
[Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]
- The topic ‘How to use cURL within the orders plugin’ is closed to new replies.