No, you cannot run the code without a script and deployment. And the data string should be an object, even if it's just sample data like '{"test":true}'.
Also, the PHP you have referred to is technically incomplete. To properly send data to NetSuite's RESTLets you need to implement an automatic retry due to the concurrency limits. That said, it doesn't help you with the problem of just connecting.
You should also be calling the NetSuite datacenter to get the proper URL.
* NetSuite SuiteAnser for datacenter calls
* https://netsuite.custhelp.com/app/answers/detail/a_id/65684
*
* Sample production response:
* {"webservicesDomain":"https://webservices.na1.netsuite.com","restDomain":"https://rest.na1.netsuite.com","systemDomain":"https://system.na1.netsuite.com"}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…