WRITE A CODE IN WEBSERVICE TO EXTRACT INFO FROM DATABASE AND OUTPUT RESULT (JSON)
$10-30 USD
Cerrado
Publicado hace más de 8 años
$10-30 USD
Pagado a la entrega
I have a table as attached. I want to attract data from the table using "curl" and output should be in "Json" once some criteria is met.
You will design the page / code; user will connect to this page using curl from their applications. They will also provide some information along when they call the page.
The page should send back two different messages (successful) and (fail) based on value from the database.
This is a sample way the user should query the page:
<?php
$ref=$_POST['tx_ref'];
$clientId = "localhost";
$secretKey = "E9300DJLXKJLQJ2993N1190023";
// perform sha512 hash
$hashValue = hash('sha512',($ref.$secretKey));
// webservice url remember to add the saved transaction reference variable
$url ="[login to view URL]$ref";
// append the header putting the secret key and hash
$headers = array(
"GET /HTTP/1.1",
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1",
"Content-type: text/xml;charset=\"utf-8\"",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Language: en-us,en;q=0.5",
"Accept-Encoding: gzip,deflate",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Keep-Alive: 300",
"Connection: keep-alive",
"clientid: $clientId",
"Hash: $hashValue" );
$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, $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
$json = json_decode($data, TRUE);
//var_dump($data);
curl_close($ch);
//print_r($json);
// you can perform simple if else to interpret the printed json result in your UI
// bye bye
}
// data from gateway after feed back
$gatewayResponseCode = $json['ResponseCode']; // ignored in form data
$gatewayResponseDescription = $json['ResponseDescription']; // ignored in form data
$gatewayPaymentReference = $json['PaymentReference']; // ignored in form data
$gatewayAmount = $json['Amount'];
$gatewayTransactionDate = $json['TransactionDate'];
$gatewayCustomerId = $json['CustomerId'];
// data from gateway before feedback
$gatereference = $form->data['ref']; // used in form data
$gatedescription = $form->data['resp_desc']; // used in form data
$gaterespcode = $form->data['resp_code']; // used in form data
I have read your project details, and I am interested in offering my services.
I provide 100% satisfaction guaranteed on all my work.
Milestone is required to begin; to be released when the job has been satisfactorily completed.
I estimate a 24hr turnaround (including weekends) on this project.
ftp details to your server will be required.
Contact me at your soonest convenience so we may get your solution delivered quickly.
Thanks,
coderXO
Hi sir,
I am scraping expert, I have did too many similar projects, please check my feedback then you will know.
Can you tell me more details? then I will provide demo data for you.
Thanks,
Kimi
Hello.
I can build this for you today.
I'd write a php script that would query the database and assembly the query output to json. you could then get that output using curl from another php script.