angelcause Posted May 29, 2013 Share Posted May 29, 2013 I am using some PHP API script to send a text message and in the <message> tags I want to get 2 values from the url (e.g. (URL address blocked: See forum rules)/sms.php?Name=John&Age=28). Problem is this that in between the php script there is a script of SOAP (I think). Sorry I am not good at programming. <?php set_time_limit(0); //URL to call define('ZONG_DOMAIN_URL', "(URL address blocked: See forum rules)"); $post_data='<?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="(URL address blocked: See forum rules)" xmlns:xsd="(URL address blocked: See forum rules)" xmlns:soap12="(URL address blocked: See forum rules)"> <soap12:Body> <SendSMS xmlns="(URL address blocked: See forum rules)/"> <Src_nbr>9145216598</Src_nbr> <Password>123</Password> <Dst_nbr>913115383168</Dst_nbr> <Mask>STAFF</Mask> <Message>Test Message from API</Message> <TransactionID>'.rand().'</TransactionID> </SendSMS> </soap12:Body> </soap12:Envelope>'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, ZONG_DOMAIN_URL ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt($ch, CURLOPT_POST, 1 ); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data ); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/soap+xml', 'charset=utf-8')); echo $result = curl_exec ($ch); ?> Quote Link to comment https://forums.phpfreaks.com/topic/278537-getting-values-from-url/ Share on other sites More sharing options...
MarPlo Posted May 29, 2013 Share Posted May 29, 2013 Hi You can use $_GET['name'] to get the value associated to 'name' from Url. Example: $post_data = '... <Message>'. $_GET['Name'] .'-'. $_GET[Age'] .'</Message> ...'; Quote Link to comment https://forums.phpfreaks.com/topic/278537-getting-values-from-url/#findComment-1432897 Share on other sites More sharing options...
angelcause Posted May 29, 2013 Author Share Posted May 29, 2013 Hi You can use $_GET['name'] to get the value associated to 'name' from Url. Example: $post_data = '... <Message>'. $_GET['Name'] .'-'. $_GET[Age'] .'</Message> ...'; Sorry MarPlo, Can you please tell me where to paste this code, can you please add it in the above actual code. Quote Link to comment https://forums.phpfreaks.com/topic/278537-getting-values-from-url/#findComment-1432902 Share on other sites More sharing options...
requinix Posted May 29, 2013 Share Posted May 29, 2013 Or is the URL a string? If so, where is it? Quote Link to comment https://forums.phpfreaks.com/topic/278537-getting-values-from-url/#findComment-1432903 Share on other sites More sharing options...
angelcause Posted May 29, 2013 Author Share Posted May 29, 2013 The url is hidden in the forum but you can see "/sms.php?Name=John&Age=28 " Quote Link to comment https://forums.phpfreaks.com/topic/278537-getting-values-from-url/#findComment-1432910 Share on other sites More sharing options...
requinix Posted May 29, 2013 Share Posted May 29, 2013 And that "/sms.php" part doesn't show up anywhere in the code you posted. I'm pretty sure that "URL address blocked" message wasn't generated by our forum. Quote Link to comment https://forums.phpfreaks.com/topic/278537-getting-values-from-url/#findComment-1433015 Share on other sites More sharing options...
angelcause Posted May 30, 2013 Author Share Posted May 30, 2013 And that "/sms.php" part doesn't show up anywhere in the code you posted. I'm pretty sure that "URL address blocked" message wasn't generated by our forum. Yes it is not in the code, thats why I wanted to know how can it be added with the values. Quote Link to comment https://forums.phpfreaks.com/topic/278537-getting-values-from-url/#findComment-1433148 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.