Hi,
When I send only one data such as
$str = "DATA=abc";
it is working fine. So that I think, I do not need to use rawurlencode.
I made folowing change according your post; again same, when I post only one
data field, it works fine. But when use three of them, server comes with
error. I think server only receive third one.
Some body told me send data in the message body. Any idea how can we do it?
Best Regads
$len = strlen($str);
$p = "POST /httpsmspp/servlet/sms HTTP/1.0\r\n";
$p.= "Host: 217.31.228.206\r\n";
$p.= "Content-type: text/plain\r\n";
$p .= "\r\n";
$p.= "Content-length: $len\r\n";
$p.= "\r\n";
$p.= "$str\r\n";
// $p.= "\r\n";
"Catalin Trifu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> > $str = "DATA=abc&DATA=123&DATA=xxx"
> I believe you should encode the string with
http://www.php.net/rawurlencode
> but make sure u don't encode the & and = signs.
> >
> > $len = strlen($str);
> >
> > $p = "POST /httpsmspp/servlet/sms HTTP/1.0\r\n";
> > $p.= "Host: 123.31.228.206\r\n";
> > $p.= "Content-type: application/x-www-form-urlencoded\r\n";
> I think you the Content-Type here is wrong, since you don't encode your
> string to match the content type. Perhaps text/plain might do it.
> > $p.= "Content-length: $len\n\n";
> here there should be another line
> $p .= "\r\n";
> here the \n\n should be \r\n
> > $p.= "$str\n";
> here \n should be \r\n
> > $p.= "\r\n";
> the above line should not exist
> > $server = "123.31.228.206";
> > $connection_timeout = 10;
> > $fp = fsockopen ($server, 80, &$errno, &$errstr, $connection_timeout);
> >
> > fputs ($fp,$p);
> > $recdata = "";
> > while (!feof($fp))
> > {
> > $recdata .= fgets ($fp,128);
> > }
> > fclose ($fp);
> >
> What is the response from the server ?
>
> Hope this helps,
> Catalin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php