In file(file, "rt") : InternetOpenUrl failed

Hi All,
I am new in this Forum:
I try to rerun a script I have used some weeks ago and worked .
The script imports stocks data. For any reason I get an error when I try use it:

> ###This script return matrix named"output" that its columns has assets and rows are theterms###
> stocks <- c("AMZN"=1,"ETFC"=1,"INTU"=1,"MU"=1,"MU"=1,"CBS"=1,"UNH"=1,"APD"=1,"BLL"=1,"HAS"=1)
> returns <- getReturns(names(stocks), freq="week")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
_ InternetOpenUrl failed: '‏‏לא היתה אפשרות לזהות את שם השרת או את כתובתו'_
In addition -attaching the sript that import the required packages I use:
library("tools", lib.loc="~/R/R-3.3.1/library")
library("devtools", lib.loc="~/R/R-3.3.1/library")
library("Matrix", lib.loc="~/R/R-3.3.1/library")
library("Rmosek", lib.loc="~/R/R-3.3.1/library")
library("stockPortfolio", lib.loc="~/R/R-3.3.1/library")
library("expm", lib.loc="~/R/R-3.3.1/library")


install.packages("devtools", repos="")

install.packages('c:/gurobi751/win64/R/', repos=NULL)

Asking your assitance to handle the error.
Thanks in advanced.

Not sure of the reason why it occurs, but I too had this issue with my Rscripts and from somewhere in the forums I was advised to run the below code before running the script which worked.


It still fails-even after runing this script