This won’t work directly since you’d need to use the HTTPS outcalls API of ICP under the hood.
Here’s an early version of a Solana RPC canister under development: GitHub - mfactory-lab/ic-solana: (WIP) Connects the Internet Computer (IC) with the Solana blockchain, offering tools and examples for interaction between IC canisters and Solana programs, facilitating the creation of cross-chain applications..
You could use it directly or use it as an inspiration.
A further example of ICP canisters talking to Solana is GitHub - weichain/galactic-bridge-icp.