I am new to web scraping here and I am trying to extract the information of the companies on this website: 
<http://apps.asiainsurancereview.com/IDA/Asp/CompanyList.aspx?company=&type=&jobType=&country=&search=company>

And the information that I want to extract is as the link below (this is the first company that is listed in the table from the first link above):

<http://apps.asiainsurancereview.com/IDA/Asp/IDA_CompanyDetails.aspx?person=&designation=&company=&country=&search=company&comslno=272>

I am trying to extract the details of each of the companies (phone number, email, website etc.) listed in the first link, then export them into a .csv file.

However, the issue is that the number in the website URL is not in sequence, for example, the first company's information URL is as above, ending with "comslno=272", but the second company has the URL ending with "comslno=1824"

I have tried the R codes as below (I know it might not be feasible)

```
library(rvest)
library(dplyr)

directory <- lapply(paste0('http://apps.asiainsurancereview.com/IDA/Asp/IDA_CompanyDetails.aspx?person=&designation=&company=&country=&search=company&comslno=', 1:9999999),
                    function(url){
                      url %>% read_html() %>% 
                        html_nodes("tr td") %>% 
                        html_text()
                    })

write.csv(directory, file = "directory.csv")

```

However, it doesn't work because the URL does not work with all the numbers between 1:9999999. 

For example, the URL ending with "comslno=1" and "comslno=2" exist but "comslno=3" does not exist.

Is there a way to make R ignore those non-existing URL and continue with the process? Or are there any other simpler ways to do this?