My host has allow_url_fopen disabled and they will not enable it for me. I need the following code to work for a WordPress plugin. Can someone please give me pointers as to how to convert this code to cURL?
else:
$results = $wpdb->get_results($wpdb->prepare("SELECT mcd_id FROM mcd_cl_coupons WHERE coupon_list_id = %d AND created_by = 'mcd'", array($coupon_list_id)));
$mcd_id = ''; foreach($results as $row): $mcd_id .= '-' . $row->mcd_id; endforeach; $mcd_id = substr($mcd_id, 1);
if($mcd_id):
$options = get_option('mcd_list');
$token = $options['api_key'];
$xml_file = 'http://www.mycoupondatabase.com/api/coupons-xml.php?token=' . $token . '&id_string=' . $mcd_id;
$xml = simplexml_load_file($xml_file);
endif;
WordPress has a function build in to request a file called
wp_remote_get:That function internally makes use of the HTTP abstraction wordpress comes with which normally figures out the best way to do HTTP requests for the system it’s running on. So it will use cUrl if everything else is restricted on your host.