The code below does not work for foreign words but works perfectly on english words.
let int=1244764800
let start=86400+$int
let l=86400*7
let end=$int-$l
for (( k = $start ; k > $end ; k=k-3600 )) do
for (( j = 1 ; j < 11 ; j++ )) do
let mintime=$k-3600;
let maxtime=$k
searchwords="سلام"
#echo $maxtime
curl "http://otter.topsy.com/search.json?q="${searchwords}"&page="$j"&perpage=100&mintime="${mintime}"&maxtime="${maxtime}"&apikey=FAF7F2D0D8A143978CB7762CE35FCF99"
done
done
This yields the following:
curl: (7) couldn't connect to host
curl: (7) couldn't connect to host
I reiterate that this script works perfectly with ENGLISH words, but I need to run this with foreign words so I would appreciate any help/guidance!
Thanks 🙂
I guess you need to
urlencodeany non-ascii characters.Try using
curl --data-urlencode, rather than justcurl.If just prepending the URL string won’t work, move parameters to data (read up on
-dofcurl) and still use--data-urlencodeHere’s a working example: