How to wite an autodial using manager APIs to play a message

Pelase help

I am writing a asterisk manager api based applicaiton to call a number and play a message as follows

$socket = fsockopen(“localhost”,“5038”, $errno, $errstr, $timeout);
fputs($socket, “Action: Login\r\n”);
fputs($socket, “UserName: test\r\n”);
fputs($socket, “Secret: test\r\n\r\n”);

fputs($socket, “\r\n”);

fputs($socket, “\r\n\r\n”);

fputs($socket, “Action: Originate\r\n\r\n”);
fputs($socket, “Channel: SIP/17209298564@\r\n\r\n”);
fputs($socket, “Context: iphone2-pbx\r\n\r\n”);
fputs($socket, “Exten: s\r\n\r\n”);
fputs($socket, “Priority: 1\r\n\r\n”);
fputs($socket, “Callerid: Asterisk Automatic Wardial\r\n\r\n”);
fputs($socket, “Action: Logoff\r\n\r\n”);
while (!feof($socket)) {
$wrets .= fread($socket, 8192);

IN the asterisk CLI, I am seeing only
== Parsing ‘/etc/asterisk/manager.conf’: Found
== Manager ‘test’ logged on from
== Manager ‘test’ logged off from

Where as an austo dial using a call file (follows) working good

Channel: SIP/1PSTN@
Callerid: 7022340175
MaxRetries: 5
RetryTime: 300
WaitTime: 45
Context: autodialer
Extension: s
Priority: 1

Within the autodialer context I have playback command to pay a message

Which is the best solution, sing call files or manager APIs, Please help