Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,227,688 members, 8,071,299 topics. Date: Wednesday, 05 February 2025 at 07:05 PM |
Nairaland Forum / Science/Technology / Programming / Call XML File With HTTP GET How? (908 Views)
Can Someone Kindly Tell Me What Is Up With Http://sachng.com/? / How To Read XML From Javascript In Xamarin Studio / XML/ JSON Format Of Nigerian Institutions And Courses (2) (3) (4)
Call XML File With HTTP GET How? by yomalex(m): 3:01pm On Mar 21, 2015 |
Hi, Maybe the title does not aptly describe the function I'm looking at. I have a file in a xml format, I want to be able to call this same file with a HTTP GET. How do I go about it? I'm not even sure I have described this scenario well. If you need more info don't hesitate to ask |
Re: Call XML File With HTTP GET How? by javadoctor(m): 3:15pm On Mar 21, 2015 |
Make a http call with method type GET to the url, it should return a 200 if the uri exists, ur call depends on if u are using ajax, java.net, or any other means |
Re: Call XML File With HTTP GET How? by yomalex(m): 4:44pm On Mar 21, 2015 |
Hi javadoctor thanks for the response please note I'm not a programmer. Directions I got from the source is this "You can always call the API using our secure Link http://sitename.com/bin/api/ You MUST make use of PHP curl(); function to call the API and it must be a POST Command" And they said I can put the code into a new file called api.php any help? |
Re: Call XML File With HTTP GET How? by javadoctor(m): 6:49pm On Mar 21, 2015 |
The thread question is totally different from wat I see here, what exactly are u trying to achieve? U need to explain vividly |
Re: Call XML File With HTTP GET How? by yomalex(m): 8:19am On Mar 22, 2015 |
Javadoctor Okay I am trying to use their API for my bulksms platform and almost all bulk sms API are usually in a HTTP GET format e.g http://www.domesms.com/sms_api.php? username=megzy&password=major&sender=Domesms &dest=234xxxxxxx&msg=Testing the API But they have HTTP POST API "Our BulkSMS API allows you to connect to our system to send BulkSMS Remotely on your own website or other platforms. Our system prevents spam and highly secured and as such, we make use of HTTP POST API. And it can be used on websites, applications and others. You can find your API Key in your client area. Our API is an XML Based API as it responses are XML. Calling The API You can always call the API using our secure Link http://sitename.com/bin/api/ You MUST make use of PHP curl(); function to call the API and it must be a POST Command. A Demonstration Below <?php $api_key = "AS38JS20382NS9292NSNSHSG"; $sender = $_POST["sender"]; //You would retrieve this from your form $recipient = $_POST["recipient"]; //You would retrieve this from your form $message = $_POST["message"]; //You would retrieve this from your form //You do not need to urlencode(); the $message $action = "sendsms"; $vars = 'api_key='.$api_key.'&sender='.$ sender.'&action='.$action.'&recipient='.$ recipient.'&message='.$message; $url = "http://sitename.com/bin/api/"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $vars); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); $run = curl_exec($ch); ?> Action to send sms is sendsms Action to send sms as reseller is resellsms and it requires parameters resellerid Action to generate voucher is genvoucher and it requires parameters resellerid and value . Voucher is returned in an XML Key voucher Action to check balance is checkbalance and response key is balance Action to loadvoucher is loadvoucher requires parameters voucher" I hope this gives you a better idea. |
Re: Call XML File With HTTP GET How? by javadoctor(m): 9:00am On Mar 22, 2015 |
Seen, you need to learn how to consume a post method using php, that's the way forward. This method requires an api_key query parameter in the url request, please learn to consume post methods. |
Re: Call XML File With HTTP GET How? by yomalex(m): 7:30pm On Mar 25, 2015 |
javadoctor:Can you do it? |
Re: Call XML File With HTTP GET How? by javadoctor(m): 10:24pm On Mar 25, 2015 |
Not in php |
Re: Call XML File With HTTP GET How? by castsports: 11:29pm On Mar 25, 2015 |
You should change from $_POST to $_GET. If you are picking up the parameters from a html form then you should also change the form's method from "post" to "get". |
(1) (Reply)
Build The Most Amazing Webpages / The New Boston Website / Programming
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2025 Oluwaseun Osewa. All rights reserved. See How To Advertise. 19 |