Thursday, February 4, 2016

PHP asynchronous Http call using curl,shell_exec


?>php

for ($i = 0; $i < 100; $i++){

  $cmd = 'nohup curl -H "Authorization: Basic yourRandomIOhere==" -H "Content-Type:        application/json" -X POST -d "{yourjson: "value"}" https://example.com/Message/ > status.out &';

  shell_exec($cmd);

}

print 'job done!';

?>


here:
100 : No of times you want to make this call
nohup:  to run in background
POST: http method, POST or GET
Authorization and content type is your option.

No comments:

Post a Comment

CSS tricks

Mixed paint in background: background: linear-gradient(to right, #b6e358, #38b143) Grid view: display: grid; grid-template-columns: a...