How to retrieve a HTML page?

Hi, I m trying to get a HTML page but it seems not to work.

this is the code

let url_str = "http:/"
    let url = URL(string:url_str )!
    do {
        let page =  try Data( contentsOf: url)
        var nToRead:Int
       if (!page.isEmpty )
        append(string: error.localizedDescription+"\n" )

What's wrong???

append just report the error The file “” couldn’t be opened.

I m newbie in Swift please HELP

Thank you!

Your missing an extra slash in your url:

let url_str = ""

Thank you, but it's not the extra slash it doesn't work also with
double slash or adding https
I tried also with multiple other website but always the same could not …

is there any protection to access from Swift? if I put the same URL in safari it works

Yes, it may be App Transport Security policy at work. This may be an Apple platform issue and not a Swift issue per se.

This forum is more for Swift language discussions, not about any particular framework, Apple or not. Although that distinction isn't always super clear, you may have better luck getting help over on Apple Developer Forums.

Many thanks sveinhal!!! Looking In the plist there is the option for network
Now it's working

Best regards