Plugin Directory

Changeset 848129


Ignore:
Timestamp:
01/30/2014 08:25:32 AM (12 years ago)
Author:
TimelySystem
Message:

Switched account lookup to use Curl rather than file_get_contents as this returned an empty response sometimes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • timely-booking-button/trunk/timely-booking-button.php

    r813267 r848129  
    5757function tbb_account_check_callback() {
    5858    $url = "https://app.gettimely.com/Register/GetSubdomainAvailability/" . $_POST['tbb_account']; 
    59     $response = file_get_contents($url);
     59    $curl = curl_init();
    6060   
     61    curl_setopt($curl, CURLOPT_URL, $url);
     62    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
     63    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     64    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
     65   
     66    $response = curl_exec($curl);   
    6167    echo ($response == "false" ? "correct" : "wrong");
    62 
    63     die(); // this is required to return a proper result
     68   
     69    die(); // this is required to return a proper result
    6470}
    6571
Note: See TracChangeset for help on using the changeset viewer.