Pesapal.com

Forum

Welcome, Guest
Username
Password:
 

Get Status requests Failing - Website Gone Slow
(1 viewing) (1) Guest
Welcome to the Pesapal integration forum!

This forum discusses everything about Pesapal integration on your web site. Having any problems? This is the right place to post a question and we are sure you will get an answer
  • Page:
  • 1

TOPIC: Get Status requests Failing - Website Gone Slow

Get Status requests Failing - Website Gone Slow 11 years, 1 month ago #1098

  • mutinda
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Hi, My wordpress E-commerce website was running well until sometimes when it turned very slow. on Checking i have identified that it keeps on spinning while sending the curl requests to get status for transactions. i.e when it gets to the following lines:

$ajax_req = new XMLHttpRequest();
$ajax_req->open("GET", $request_status);
$ajax_req->send();

This was working fine till some day just broke.

my website is flyingdoctorsafrica.org/

Any help as i try to resolve this because it cant get the status either.

Regards

Re: Get Status requests Failing - Website Gone Slow 11 years, 1 month ago #1099

  • lazro
  • OFFLINE
  • Administrator
  • Pesapal
  • Posts: 404
Hello mutinda,

Use CURL to check the status instead of XMLHTTPREQUEST.


//get transaction status
$request_status = OAuthRequest::from_consumer_and_token($consumer, $token, "GET", $statusrequestAPI, $params);
$request_status->set_parameter("pesapal_merchant_reference", $pesapal_merchant_reference);
$request_status->set_parameter("pesapal_transaction_tracking_id",$pesapalTrackingId);
$request_status->sign_request($signature_method, $consumer, $token);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_status);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
if(defined('CURL_PROXY_REQUIRED')) if (CURL_PROXY_REQUIRED == 'True')
{
$proxy_tunnel_flag = (defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE') ? false : true;
curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag);
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt ($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS);
}

$response = curl_exec($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$raw_header = substr($response, 0, $header_size - 4);
$headerArray = explode("\r\n\r\n", $raw_header);
$header = $headerArray[count($headerArray) - 1];

//transaction status
$elements = preg_split("/=/",substr($response, $header_size));
$status = $elements[1];


For more on the same, have a look at this example: developer.pesapal.com/forum/2-pesapal-in...-pesapal-php-example
Regards,

Lazaro Ong'ele
Web Developer

Skype: Lazrotep
+254-020-249-5438 ; +254-706-191-729
Dagoretti Lane, Off Naivasha Road.

Facebook: www.facebook.com/pesapal
Twitter: twitter.com/PesaPal
Helpdesk: support.pesapal.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it.
The following user(s) said Thank You: mutinda
  • Page:
  • 1