No, the stock market is not there for speculation on corporate memorabilia. At its base, it is there for investing in a business, the point of the investment being, of course, to make money. A (successful) business earns money, and that makes it valuable to its owners since that money can be distributed to them. Shares of stock are pieces of business ownership, and so are valuable.
If you knew that the business would have profit of $10,000,000 every year, and would distribute that to the owners of each of its 10,000,000 shares each year, you would know to that each share would receive $1 each year. How much would such a share be worth to you? If you could instead put money in a bank and get 5% a year back, to get $1 a year back you would have to put $20 into the bank. So maybe that share of stock is worth about $20 to you. If somebody offers to sell you such a share for $18, you might buy it; for $23, maybe you pass up the offer.
But business is uncertain, and how much profit the business will make is uncertain and will vary through time. So how much is a share of a real business worth? This is a much harder call, and people use many different ways to come up with how much they should pay for a share. Some people probably just think something like "Apple is a good company making money, I'll buy a share at whatever price it is being offered at right now." Others look at every number available, build models of the company and the economy and the risks, all to estimate what a share might be worth, more or less. There is no indisputable value for a share of a successful business.
So, what effect does a company's earnings have on the price of its stock? You can only say that for some of the people who might buy or sell shares, higher earnings will, all other thing being equal, have them be willing to spend more to buy it or demand more when selling it. But how much more is not quantifiable but depends on each person's approach to the problem. Higher earnings would tend to raise the price of the stock. Yet there are other factors, such as people who had expected even higher earnings, whose actions would tend to lower the price, and people who are OK with the earnings now, but suspect trouble for the business is appearing on the horizon, whose actions would also tend to lower the price. This is why people say that a stock's price is determined by supply and demand.