prefix . "comments"; $getcomment = "SELECT comment_content from ".$table_name." where comment_ID = ".$commentID.";"; $content = $wpdb->get_var($getcomment); $host = gethostbyaddr($_SERVER['REMOTE_ADDR']); # variable $host = 'opensms.movistar.es'; $service_uri = '/aplicacionpost/loginEnvio.jsp'; $tm_login = get_option('tm_login'); $tm_password = get_option('tm_password'); $tm_to = get_option('tm_to'); $tm_mensaje = get_option('tm_mensaje'); $vars ="TM_ACTION=AUTHENTICATE&TM_LOGIN=".$tm_login."&TM_PASSWORD=".$tm_password."&to=".$tm_to."&message=".$tm_mensaje; # cabecera http HTTP $header = "Host: $host\r\n"; $header .= "User-Agent: PHP Script\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: ".strlen($vars)."\r\n"; $header .= "Connection: close\r\n\r\n"; $fp = pfsockopen($host, 443, $errno, $errstr); if (!$fp) { echo "$errstr ($errno)
\n"; echo $fp; } else { fputs($fp, "POST $service_uri HTTP/1.1\r\n"); fputs($fp, $header.$vars); fwrite($fp, $out); // muestra la salida (opcional) //while (!feof($fp)) { // echo fgets($fp, 128); // } fclose($fp); } } add_action('comment_post', 'send_sms'); ?>