Most opti-isolators are equivalent to an NPN transistor with the base isolated electrically.
You need the same sort of circuitry you'd use with an NPN - base resistor on the input (but sized for LED current rather than transistor gain), Output emitter connected to ground, load in between the collector and +V (and current limited as appropriate for the load.)
Most couplers have really poor gain - they're aimed at signal transfer and digital logic rather than "load switching." Output current for the PC817 is rated as about 50% of the input current (in the datasheet as "current transfer ratio.") Typically you need an additional transistor or something (power by the output-side voltage supply) if your load needs any substantial current (like an LED or a Relay coil.)
If the current transfer ratio (CTR) is 50%, then the collector current would be limited by the CTR. IC or output led current would be 9.5/2=4.75mA.
If the current transfer ratio (CTR) is 600%, then the collector current would be limited by the 220Ω resistor. IC or output led current would be (5-2)/220=13.6mA
A point of interest - you didn't need to draw a schematic in software, draw a simple sketch on a piece of paper, take a photo, post the photo in your thread message. It's really that simple. This thread really should have been complete by about post #6.
C'mon back with your next question, but please draw a simple schematic when you do.
Since you don't need an opto to just drive an LED, the assumption is that some logic element is going to receive the signal as well as the LED.
TTL is active LOW. A high side switch cannot pull the output lower than the LED forward bias - probably more than the maximum LOW. THIS is the issue. The opto doesn't care high or low, but the LOGIC does ...
Ahh, so you see my point with the extra 10k resistor in parallel with the led and its resistor. As I said, the initial circuit may not produce the desired result.
To what? Most op-amps don't provide galvanic isolation. As a buffer stage for currect gain, sure, but what needs the extra drive? TTL maxes out at 20mA.