Re: [PHP] http response 200

2008-06-20 Thread tedd

At 3:57 PM -0400 6/20/08, Daniel Brown wrote:

My preference here would be:





Arrggg!

switch ($status)
   {
   case 'RETEMP02':
   echo "Mobile number is empty.";
   break;

   case 'RETEMP03':
   echo "Message is empty.";
   break;

   case 'RETEMP05':
   echo "Message Id is empty.";
   break;

   case 'RETVAL03':
   echo "Invalid mobile number.";
   break;

   case 'RETVAL04':
   echo "Mobile number not recognized.";
   break;

   case 'RETVAL05':
   echo "Message is containing illegal character.";
   break;

   default:
   echo "Message has been sent successfully.";
   break;
   }

For me, this is easier to read, edit, maintain, and understand. And, 
the reason why I have never used elseif -- thank God the case 
statement came before elseif's.


And don't think that I don't see all of you scurrying away checking 
old programming manuals to prove me wrong, but I think you'll find 
I'm right.  :-)


In any event, elseif's are vexations to the sprit.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] http response 200

2008-06-20 Thread Daniel Brown
On Fri, Jun 20, 2008 at 5:35 AM, joaquinbordado <[EMAIL PROTECTED]> wrote:
>
> 'm a total newbie..i just want to know how can i display an http response 200
> with this message "message successfully sent" ...here is my code

HTTP code 200 just means OK.  Any successful location and serving
of a web file will result in HTTP 200.

>  if ($status == "RETEMP02")
> echo "Mobile number is empty.";
> elseif ($status == "RETEMP03")
> echo "Message is empty.";
> elseif ($status == "RETEMP05")
> echo "Message Id is empty.";
> elseif ($status == "RETVAL03")
> echo "Invalid mobile number.";
> elseif ($status == "RETVAL04")
> echo "Mobile number not recognized.";
> elseif ($status == "RETVAL05")
> echo "Message is containing illegal character.";
> elseif ($status == "")
> echo "Message sending failed";
> else
> echo "Message has been sent successfully.";
> ?>

My preference here would be:



In any case, regardless of what message is echoed out from above,
it will give an HTTP 200/OK response.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] http response 200

2008-06-20 Thread Iv Ray

ryan gacusana wrote:

here is my code
when accessing this url
http://localhost/podcast/podcast.php?mobile=0823172&message=2343443=%3Eryan 


This runs on your computer, I can't access it.


else
echo "Message has been sent successfully.";
// in this part i want to respond with a status of 200,sorry i just 
started php last wik


Actually... If you print this text, the web server sends status 200 to 
the browser on its own accord. Or am I missing something.


The code I sent you sends custom 404 Not Found - in case you need that.

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] http response 200

2008-06-20 Thread Iv Ray

joaquinbordado wrote:
> 'm a total newbie..i just want to know how can i display an http 
response 200


Don't have time to customize it for you, but that's how it can be done-

header("HTTP/1.0 404 Not Found");
/*
 *
 * I copied the DOCTYPE from what Apache 1.3.34 returns.
 *
 */
echo "";
echo "";
echo "";
echo "404 Not Found";
echo "";
echo "";
echo "Not Found";
echo "The requested URL " . $_SERVER['REQUEST_URL'] . "was not found 
on this server.";

echo "";

Note, that you must not have any output before sending header(). There 
is a way to check, write back, if interested how.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] http response 200

2008-06-20 Thread joaquinbordado

'm a total newbie..i just want to know how can i display an http response 200
with this message "message successfully sent" ...here is my code

-- 
View this message in context: 
http://www.nabble.com/http-response-200-tp18026193p18026193.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php