Summary.Let be the unit disk in the complex plane and let be a compact, simply connected subset of , whose boundary is assumed to belong to the class . Let be the unit ball of the Hardy space . A linear algorithm is constructed for approximating functions in . The algorithm is based on sampling functions in the Fejer points of and it produces the error Here denotes the space of continuous functions on and is the Green capacity of with respect to . Moreover it is shown that the algorithm is asymptotically optimal in the sense of -widths.