Hi,
I made a script to sent sms from a php page by faking a form send with fsockopen.
I have an account at www.f2s.com and i get this error:
Warning: Supplied argument is not a valid File-Handle resource in /web/sites/232/eracata/www.bascalie.f2s.com/sms_immk_net.php on line 23
Warning: Supplied argument is not a valid File-Handle resource in /web/sites/232/eracata/www.bascalie.f2s.com/sms_immk_net.php on line 24
Warning: Supplied argument is not a valid File-Handle resource in /web/sites/232/eracata/www.bascalie.f2s.com/sms_immk_net.php on line 25
Warning: Supplied argument is not a valid File-Handle resource in /web/sites/232/eracata/www.bascalie.f2s.com/sms_immk_net.php on line 26
Warning: Supplied argument is not a valid File-Handle resource in /web/sites/232/eracata/www.bascalie.f2s.com/sms_immk_net.php on line 27
Warning: Supplied argument is not a valid File-Handle resource in /web/sites/232/eracata/www.bascalie.f2s.com/sms_immk_net.php on line 28
Warning: Supplied argument is not a valid File-Handle resource in /web/sites/232/eracata/www.bascalie.f2s.com/sms_immk_net.php on line 29
Warning: Supplied argument is not a valid File-Handle resource in /web/sites/232/eracata/www.bascalie.f2s.com/sms_immk_net.php on line 37
My PHP code is(taken from this forum):
function PostToHost($host, $path, $data_to_send)
{
$fp = fsockopen($host,80);
fputs($fp, "POST $path HTTP/1.1\n");
fputs($fp, "Host: $host\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
fputs($fp, "Referer: http://www.immk.net/sms/indexen.htm\n");
fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
fputs($fp, "Connection: close\n\n");
fputs($fp, $data_to_send);
// Print the page with the values you sent....
while(!feof($fp))
{
//echo fgets($fp, 128);
$htmlreply.=fgets($fp, 128);
}
fclose($fp);
print $htmlreply;
}
$host="http://toponwap.com";
$path="/scgi-bin/Premium.cgi";
$telefon="4092355699";
function make_seed()
{
list($usec,$sec) = explode(" ", microtime());
return ((float)$sec+(float)$usec) * 100000;
}
mt_srand(make_seed());
$nr=mt_rand(1,10);
for($i=1;$i<=$nr;$i++)
$text.="bla ";
$text=$nr." ".$text;
$date="VratiSeNa=http://immk.net/sms/&BrojTelefona=$telefon&Poruka=$text&B1=Send&DrzavaOperator=%2B";
PostToHost($host,$path,$date);
?>
Can anyone help me, and tell me what is wrong here.
I checked this code on my computer and all is working very good (the data from the fake form is sent) and on my account on www.f2s.com is not working.
Thanks