Jump to content

Getting Values from URL


angelcause

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.
 
 
<?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);
 
?>

 

Link to comment
https://forums.phpfreaks.com/topic/278537-getting-values-from-url/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.