You have a fuel problem if it starts by pouring gas in carb. What kind is hard to say. First eliminate filter as a problem. Take out all inline filters or replace. Address any filter at carb inlet as Jerry and others have said. Then do visual squirt test. Then take off/leave off gas cap. Then test drive awhile and report.
Don't do everything at once. One thing or sequence at a time. May take several days. Otherwise you will not figure it out. You may think that's OK as long as it runs, WRONG! It may be two things, it may be intermittent, it may be a bad new part, you won't learn anything, if it does it again in a week, you have to start all over.
This is proper troubleshooting and all the suggestion above by the guys are good ones. Let us know what you find out before next steps unless you are experienced.
How old is gas tank? Has it been serviced? After above prcedures, next step is flow test at carb, then carb itself. The squirt test will reveal something about both of those issues but not 100%. Also if it runs with gas cap off but not on, that's good news. Easy fix. Hope you did not buy a fancy/non stock fuel pump.
Usually when you pour gas into carb it starts and runs for few seconds. If you are sure it only starts when you do that AND if it goes several blocks, that's a little different than I've seen. It seems to point to intermittent blockage or weak pump. What does choking it with hand or other do for it? If there was no fuel in bowl or no pump pressure at all, it would not go a few blocks. But on the other hand if there was fuel in the bowl it should squirt,(and start) if accelerator pump is OK. CarbKing can correct me if I'm wrong.