Waleed Ali
Waleed Ali

Reputation: 21

Curl working on local but not working on live domain

$url="http://182.191.78.79:92/api/ERP/Login?UserName=xxx&Password=xxx&LocationId=";

$secretKey = "sk_test_1234567";



  // append the header putting the secret key and hash

  $request_headers = array();
//  $request_headers[] = 'Authorization: Bearer ' . $secretKey;
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_TIMEOUT, 60);
 // curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  $data = curl_exec($ch);

  if (curl_errno($ch))
    {
    print "Error: " . curl_error($ch);
    }
    else
    {
    // Show me the result

    $transaction = json_decode($data, TRUE);

    curl_close($ch);

    var_dump($transaction);

  }

Upvotes: 0

Views: 710

Answers (1)

maio290
maio290

Reputation: 6742

Did you check if curl is available in PHP on your server?

function _isCurl(){
    return function_exists('curl_version');
}

Source: https://stackoverflow.com/a/13433965/4934937

If your server is running php5 and using linux, you can try to install the package php5-curl, since it's not installed by default.

Upvotes: 1

Related Questions