I am connecting to mySQL database using a shell script. After connecting to the mySQL database, I execute a query. The query gives me 300,000 URLs as the result.
For each of the 300,000 URLs I need to check if the URLs actually exist and need to update the table that the URL is checked for its existence.
I have planned on using the curl command. I am giving the command as below.
curl -s --head http://myurl/ | head -n 1 | grep "HTTP/1.[01] [23].."
If I just give the command in my shell, I am getting the response (like 301, 200 etc). However, I need it in a variable so that I can use it for some manipulation purposes. For example, like below.
$var = curl -s --head http://myurl/ | head -n 1 | grep "HTTP/1.[01] [23].."
echo $var;
if ($var == "some value")
{
do something;
}
else
{
do some other thing;
}