T
T
TERRAN472017-03-03 13:52:07
Laravel
TERRAN47, 2017-03-03 13:52:07

How to send get request by cron schedule timing in laravel?

Hello everyone, I'm thinking ... I need to check all successfully completed payments in the database every day and write them off as the bank orders, that's not the point, I created cron

$schedule->call(function (){
            $spisanies = Spisanie::where('spisanie_check','=',true)->get();
        
            $kkb = new KKBSign();
            
            $kkb->invert();

            $kkb->load_private_key("kkb/cert.prv", "WDfUveEf5i6");

            foreach ($spisanies as $spisanie) {
                $merchant = '<merchant id="93723431"><command type="complete"/><payment reference="'.$spisanie->spisanie_reference.'" approval_code="'.$spisanie->spisanie_approval_code.'" orderid="'.$spisanie->spisanie_order_id.'" amount="'.$spisanie->spisanie_amount.'" currency_code="398"/></merchant>';
                            
                $merchant_sign = '<merchant_sign type="RSA" cert_id="c333e074">'.$kkb->sign64($merchant).'</merchant_sign>';
                
                $xml = "<document>".$merchant.$merchant_sign."</document>";

                $mainXML = base64_encode($xml);
                return Redirect("/answers/".$mainXML);
            }

        })->dailyAt('16:05');

and I'm thinking how to send it to the address https://epay.kkb.kz/jsp/remote/control.jsp now?
get request with my generated xml,
I did this
in schedule and threw it higher
in the route
Route::get('/answers/{xml}', 'Rus\[email protected]');

in controller
public function answers($xml){
    return view('rus.answer',['xml'=>$xml]);
  }

in a view
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> 
<script>
  $.ajax({
    url:'https://epay.kkb.kz/jsp/remote/control.jsp?{{$xml}}',
    type:'get'
  });
</script>

but something doesn't work(
Any suggestions?
PEOPLE ACTUALLY I JUST NEED TO SEND A GET (sorry caps) request without human intervention, how to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
ctpayc, 2017-03-03
@ctpayc

Good afternoon
try https://github.com/guzzle/guzzle

A
Anton Anton, 2017-03-03
@Fragster

How difficult. You can send via curl, without any views, in the same script that collects XML.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question