Reputation: 134
I have route like this:
Route::get('cron_job/{param1}/{param2?}', function($param1 = NULL, $param2 = NULL)
{
//do something here;
echo "Im'm here with param". $param1;
});
I use this route for cron jobs and it works OK.
But now, I want to try it with another route to test it with loop, like this:
Route::get('test_cron_job', function()
{
do {
$param = 1;
// here I just want to call http://my_app.local/cron_job/$param1
$param++;
} while ($param <10)
});
How to do it? In cronjob I use:
links -dump http://my_app.local/cron_job/$param1
But how to call it inside another route in route.php to test it?
Upvotes: 1
Views: 830
Reputation: 79
Let try:
Route::get('test_cron_job', function()
{
do {
$param1 = 1;
// here I just want to call http://my_app.local/cron_job/$param1
redirect('/cron_job/'.$param1);
$param++;
} while ($param <10)
});
Upvotes: 0
Reputation: 532
You can use file_get_content(url);
$file = file_get_contents("http://www.example.com/{$param1}", false, $context);
Upvotes: 2