The answer is probably pretty simple but here it goes:
I am creating a web spider to fetch information off of a website. All is going well, except one thing. The website stores articles in this format:
/articlecategory/category001.html
/articlecategory/category002.html
/articlecategory/category003.html
You get it, right? The articles go up to hundreds..
The problem is, that the site switches the amount of zeros around.. for example, in a different category it might store info as:
/articlecategory/category01.html
/articlecategory/category02.html
/articlecategory/category03.html
See how a zero is taken away?
My spider uses an infinite loop that stops when fopen results in an error. Each time the loop executes, it adds 1 to a variable. This is how I have been incrementing my numbers.
I need a way to pass a digit length...
/mysite/script.php?length=3
The script should read the length and set the digit amount to that number. So in case of a three, it should autmatically add two zeros before a single digit number, and two before one before two digit numbers...
No, I dont want to use a hardcore way of using IF statements, or CASE statements...
Is there a way to do this?