Page 1 of 1

[SOLVED] Designing a new system

Posted: Fri Aug 05, 2005 7:02 am
by Devnull
I currently got a service which can send text messages to mobiles and works with a URL, e.g. http://domain.com/sms.txt?n=+34666000500&m=test.

I'm going to design a system where a user logs in and can type a message out and click send and it goes to the URL above (It's going to be going to more than one phone), however, I don't want the user to see this URL; what can I do to hide it?

Furthermore, when you go to the URL I stated above you get a message, e.g: 1 OK, 2 OK, 3 OK, 4 BAD (In this case you are going to send it to four mobiles). Is there any way I can stop the user seeing this messages on the other website but instead I want a user to see my message, on my website saying, 3 sms were sent out ok, 1 was bad?

Thanks!

Posted: Fri Aug 05, 2005 7:59 am
by timvw
Let the user POST to a script of you. And then let that send the data to the webservice.. Beautify the results of that action and echo them back to the user..

Posted: Fri Aug 05, 2005 8:04 am
by Devnull
That's what I had in mind, but when the user hits submit and it goes to my script what php function would I use? If I used Header('Location: url'); the user would see the address of this other website...

Posted: Fri Aug 05, 2005 8:12 am
by timvw
In that case your script is not performing the request.. But you are simply redirecting him..

Instead do something like: (Here i use the HTTP(S) wrapper, but you could also use curl, snoopy, simpletest browser, ...)

Code: Select all

$result = file_get_contents('http://someotherhost.example.org?userid=foo&message=bar');

if ($result == '01 OK')
{
  $message = 'Everything went well.........';
}

echo $result

feyd | ;)

Posted: Fri Aug 05, 2005 8:24 am
by Devnull
timvw wrote:In that case your script is not performing the request.. But you are simply redirecting him..

Instead do something like: (Here i use the HTTP(S) wrapper, but you could also use curl, snoopy, simpletest browser, ...)


$result = file_get_contents('http://someotherhost.example.org?userid=foo&message=bar');

if ($result == '01 OK')
{
$message = 'Everything went well.........';
}

echo $result
Cool, that's helped me out. Could you givce me an example using Curl ?