Plugin Directory

Changeset 711146


Ignore:
Timestamp:
05/11/2013 12:00:25 AM (13 years ago)
Author:
ShopSite
Message:

Change fopen to CURL

Location:
shopsite-plugin/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • shopsite-plugin/trunk/readme.txt

    r573301 r711146  
    33Tags: e-commerce, shopping, shopsite
    44Requires at least: 3.2.0
    5 Tested up to: 3.3.1
     5Tested up to: 3.5.1
    66Stable tag: trunk
    77
     
    2929
    3030== Changelog ==
     31= 1.3 =
     32* Changed shopper-facing product download method to allow product display in the blog for some PHP config settings.
     33
    3134= 1.2 =
    3235* Added a Test Connection button on the configuration screen. Added a 30-second connection timeout.
  • shopsite-plugin/trunk/shopsite.php

    r573301 r711146  
    300300  );
    301301 
     302
     303 
    302304  if (!$products_xml['success']) {
    303305    echo $products_xml['error'];
     
    498500  $url = $shopsite_url."&operation=get_products&".$identifier."_list=".$id_list."&signature=".$signature;
    499501  ///debug_print($url);
    500   $url_openable = ini_get('allow_url_fopen');
     502  /*$url_openable = ini_get('allow_url_fopen');
    501503  ini_set('allow_url_fopen', true);
    502504  $handle = fopen($url,'r');
    503505  ini_set('allow_url_fopen', $url_openable);
    504     print(stream_get_contents($handle));
     506    print(stream_get_contents($handle));*/
     507  print(curl_open($url));
    505508}
    506509
    507510function test_connection() {
     511
     512  if  (!in_array  ('curl', get_loaded_extensions())) {
     513    return array("success"=>false, "error"=>"CURL PHP extension is not installed on your server. Contact your hosting provider.");
     514  }
     515
    508516  $test_download_xml = oauth(
    509517    get_option('clientid'), get_option('secretkey'), get_option('code'), get_option('authorizationurl'),
     
    516524 
    517525   
    518   $shopsite_url = get_option('shopsite_url');
     526  /*$shopsite_url = get_option('shopsite_url');
    519527  $url_openable = ini_get('allow_url_fopen');
    520528  ini_set('allow_url_fopen', true);
     
    524532 
    525533  if ($handle == false)
     534    return array("success"=>false, "error"=>"Check your callback URL");*/
     535 
     536  if (curl_open(get_option('shopsite_url')) == false)
    526537    return array("success"=>false, "error"=>"Check your callback URL");
    527538 
     
    533544}
    534545
     546function curl_open($url) {
     547  $ch = curl_init();
     548  curl_setopt($ch, CURLOPT_URL, $url);
     549  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     550  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
     551  $html = curl_exec($ch);
     552  curl_close($ch);
     553     
     554  return $html;
     555}
     556
    535557?>
Note: See TracChangeset for help on using the changeset viewer.