[SOLVED] Designing a new system

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Devnull
Forum Commoner
Posts: 52
Joined: Fri Oct 22, 2004 2:19 pm

[SOLVED] Designing a new system

Post 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!
Last edited by Devnull on Fri Aug 05, 2005 9:50 am, edited 1 time in total.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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..
User avatar
Devnull
Forum Commoner
Posts: 52
Joined: Fri Oct 22, 2004 2:19 pm

Post 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...
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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 | ;)
User avatar
Devnull
Forum Commoner
Posts: 52
Joined: Fri Oct 22, 2004 2:19 pm

Post 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 ?
Post Reply