That code will not work on the Yun, it is intended for a more traditional Arduino with an Ethernet shield. The Yun uses a completely different philosophy for networking. Basically, if the sketch you are looking at includes Ethernet.h or WiFi.h, it simply will not work with the Yun.
The equivalent example sketch you want to be looking at is HttpClient example. compare the code, see how much simpler it is? The code you are trying manages all of the networking using the sketch and the limited resources of the AVR processor. The Yun version does all of the networking management using the Linux processor - this makes the networking much more powerful, and greatly simplifies the sketch, leaving more of the limited AVR resources for use by a more complicated sketch.
What seems to have happened is that the poster in this other thread noted a problem. The solution got propagated into the example in the IDE but did not get propagated to the link at https://www.arduino.cc/en/Tutorial/HttpClient
Then the original server issue was resolved and now the “old” web code works and the “new” IDE code is broken.
I mention all of this to show my appreciation for the help and also to assist the moderators/developers in reverting the change in the IDE for the next IDE release.
Sometimes I am not very clear so if I haven’t been clear here, let me know and I will elaborate if I can be of help.