Hamdan Shafiq
asked on
any one can help me for error?
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
OK
Failed to connect to 10.2.217.48 port 443: Connection timed out
OK
Failed to connect to 10.2.217.48 port 443: Connection timed out
Please share the string you are trying JSON Parse.
ASKER
thank for replay
sadad.php
sadad.php
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON datathe error seems come from your JSON data not from the php code.
it seems that error came from the very first line of your JSON data, post it here when necessary
or use some online JSON verifier for the checkings.
https://jsonformatter.curiousconcept.com/
https://jsonlint.com/
ASKER
file attached here
soap.php
soap.php
ASKER
<?php
$olpIdAlias='RBUAT190';
$merchantID='1039';
$refNum=rand(1, 15).rand();
$amount='200';
$xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://olp.bank.com/sappay/service/olppaymentmanager/req">
<soapenv:Header/>
<soapenv:Body>
<req:initiatePaymentDetail sReq>
<olpIdAlias>'.$olpIdAlias. '</olpIdAl ias>
<merchantId>'.$merchantID. '</merchan tId>
<merchantRefNum>'.$refNum. '</merchan tRefNum>
<paymentAmount>'.$amount.' </paymentA mount>
<paymentCurrency>SAR</paym entCurrenc y>
<dynamicMerchantLandingURL ></dynamic MerchantLa ndingURL>
<dynamicMerchantFailureURL ></dynamic MerchantFa ilureURL>
</req:initiatePaymentDetai lsReq>
</soapenv:Body>
</soapenv:Envelope>';
try{
$url = "https://b2b.rb.com/soap?service=RB_OLP_INITIATE_PAYMENT";
$certFile = dirname(__FILE__)."/key.pe m";
$certPass ='b2b123';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSLCERT, $certFile);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $certPass);
$headers = array();
array_push($headers, "Content-Type: text/xml; charset=utf-8");
array_push($headers, "SOAPAction: sii:RB_OLP_INITIATE_PAYMEN T");
array_push($headers, "Host:b22.rb.com");
if($xml != null) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
array_push($headers, "Content-Length: " . strlen($xml));
}
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
print_r($response);
exit;
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
print_r($response);
} catch (Exception $e){
echo $e->getMessage();
}
?>
$olpIdAlias='RBUAT190';
$merchantID='1039';
$refNum=rand(1, 15).rand();
$amount='200';
$xml = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://olp.bank.com/sappay/service/olppaymentmanager/req">
<soapenv:Header/>
<soapenv:Body>
<req:initiatePaymentDetail
<olpIdAlias>'.$olpIdAlias.
<merchantId>'.$merchantID.
<merchantRefNum>'.$refNum.
<paymentAmount>'.$amount.'
<paymentCurrency>SAR</paym
<dynamicMerchantLandingURL
<dynamicMerchantFailureURL
</req:initiatePaymentDetai
</soapenv:Body>
</soapenv:Envelope>';
try{
$url = "https://b2b.rb.com/soap?service=RB_OLP_INITIATE_PAYMENT";
$certFile = dirname(__FILE__)."/key.pe
$certPass ='b2b123';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSLCERT, $certFile);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $certPass);
$headers = array();
array_push($headers, "Content-Type: text/xml; charset=utf-8");
array_push($headers, "SOAPAction: sii:RB_OLP_INITIATE_PAYMEN
array_push($headers, "Host:b22.rb.com");
if($xml != null) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
array_push($headers, "Content-Length: " . strlen($xml));
}
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
print_r($response);
exit;
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
print_r($response);
} catch (Exception $e){
echo $e->getMessage();
}
?>
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.