Reputation: 80
I am connecting to an eCommerce website's API, to get product reviews from them, what I want to do is to set the product ID which I want it's review using a loop iterator from 1 to 10, for example:
loop from i = 1 until 10
product_id=i
// here I want to tell my php script to resubmit itself with the new product_id
I found that cron would submit it to me, but then I won't be able to loop on the product_id, I will have to synchronize between the cron and the iterator in the php script which is not efficient solution at all. does anyone know how to help me
Upvotes: 0
Views: 76
Reputation: 243
You can rewrite your php script to use $argv http://php.net/manual/en/reserved.variables.argv.php
then you can pass it like
#!/bin/bash
for i in {1..5}
do
php script.php $i
done
save it as .sh file and add it to CRON
Upvotes: 1