Awaken88 Posted July 7, 2010 Share Posted July 7, 2010 Hello! I'm new to coding PHP, just trying to do a simple Web app for my work to make my job a bit easier. Basically, it is an SMS app, We have a company that we send SMS's through, which now has an API so i can just send a string straight to the site and it sends the message. Basically i made a PHP script that takes some values from a page, mobile which i will enter, then select a template from a drop down box and hit send... I have all that part working perfectly!! Only problem is, i don't know where to start to send the final string (Url + $mob + $message) I'm guessing i need to make a function to do this, but as to where to start I don't have a clue. I've seen a few places that have what I think i need, but i don't understand completely. Any help would be appreciated. Atm, I want to have $messagesent = $SendText($url) and get a responce to say that the message has sent fine or not. My url is all configured how i would need it (meaning if i put it in my web browser it sends the message) http://mysmssend.com/api-wrapper/messages.single?apikey=111222233333&apisecret=secret&mobile=Mobile&message=Message+Goes+Here&caller_id=xxxxxxxxxx Is there any way I can just put that in there? It does redirect to another site once the API has been run.. and displays.. messages.single 1 2010-07-07 12:47:30 GMT 1278506850 GMT queued no list provided Guess all i would want to know is that its been queued or that the process ran Any help would be great! I understand i need to open sockets? Then send the info, but as what format the info needs to be is unsure. Regards, Richard Quote Link to comment https://forums.phpfreaks.com/topic/207001-send-request/ Share on other sites More sharing options...
trq Posted July 7, 2010 Share Posted July 7, 2010 file_get_contents should suffice. Quote Link to comment https://forums.phpfreaks.com/topic/207001-send-request/#findComment-1082421 Share on other sites More sharing options...
Awaken88 Posted July 7, 2010 Author Share Posted July 7, 2010 tried $smsent = file_get_contents($url) Doesn't work, just makes the web page hang? I know that the $url is correct as i had it just post it to the page before. Anything I may be doing wrong? And does file_get_contents need to be an actual file... as its not a file just a url.. ? Quote Link to comment https://forums.phpfreaks.com/topic/207001-send-request/#findComment-1082437 Share on other sites More sharing options...
trq Posted July 7, 2010 Share Posted July 7, 2010 You need to have allow_url_fopen enabled within your php configuration. Make sure you have error reporting and display errors setup while developing too. Quote Link to comment https://forums.phpfreaks.com/topic/207001-send-request/#findComment-1082443 Share on other sites More sharing options...
Awaken88 Posted July 7, 2010 Author Share Posted July 7, 2010 Ah okay, i'm just using my ISP's free service atm... wouldn't know if that was enabled. Plus also don't know how to check errors etc :/ Like i said i'm still learning Quote Link to comment https://forums.phpfreaks.com/topic/207001-send-request/#findComment-1082446 Share on other sites More sharing options...
trq Posted July 7, 2010 Share Posted July 7, 2010 If its a fee service it is likely disabled. You can check via phpinfo. You can set error reporting up at runtime by placing the following at the top of all your scripts. <?php error_reporting(E_ALL) ; ini_set('display_errors', '1'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/207001-send-request/#findComment-1082450 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.