Jump to content

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.

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.

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