Jump to content

Getting Values from URL


Recommended Posts

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.
//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)">
<SendSMS xmlns="(URL address blocked: See forum rules)/">
 <Message>Test Message from API</Message>
$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);


Link to comment
Share on other sites


You can use $_GET['name'] to get the value associated to 'name' from Url.


$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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.