Title: Build string from Post fields
Last modified: August 19, 2016

---

# Build string from Post fields

 *  [irishnights](https://wordpress.org/support/users/irishnights/)
 * (@irishnights)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/build-string-from-post-fields/)
 * Hi,
 * I’m trying to join some post fields together in a string, which will then form
   the text in a URL which gets sent via an API for an SMS send function.
 * My problem is, I can’t get the string to be constructed properly and passed into
   my URL call. I’m finding all tomorrows posts and trying to construct the string
   while its looping.
 * <?php
    //Get the next day timestamp $next_day_timestamp = mktime(0,0,0,date(“
   m”), date(“d”)+1, date(“Y”)); $day_num = date(“j”, $next_day_timestamp); $month_num
   = date(“n”, $next_day_timestamp); $year_num = date(“Y”, $next_day_timestamp);
 * query_posts(‘year=’ .$year_num .’&monthnum=’ .$month_num .’&day=’ .$day_num );
 * if (have_posts()) :
    while (have_posts()) : the_post();
 *  $api_id = XXXXXXXX; // MSG API ID
    $api_pwd = XXXXXXXX; // MSG API PASSWORD 
   $group_alias = XXXXXXXX; //MSG Group Alias $sender_tag = SportsPark; //MSG Sender
   Tag $api_url=”[http://www.XXXXXXXX.com/api/send_text.html&#8221](http://www.XXXXXXXX.com/api/send_text.html&#8221);;
   $post_data=”api_id=”.$api_id.”&api_pwd=”.$api_pwd.”&tag=”.$sender_tag.”&dest=”.
   $group_alias; $title = the_title(); $date = the_time(‘l, F jS’); $time = the_time();
   $key = “Visiting_Team”; echo get_post_meta($post->ID, $key, true); $details =
   the_content(); $event = $title.$date.$time.$key.$details;
 * $url = $api_url.”?”.$post_data.”&txt=”.$event;
    $request = new WP_Http; $result
   = $request->request( $url ); echo $result[‘body’];
 *  endwhile;
    endif;
 * ?>
 * All I get is an SMS with “Visiting_Team” in the text!!!
 * Any ideas out there please.

The topic ‘Build string from Post fields’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [string](https://wordpress.org/support/topic-tag/string/)

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 0 replies
 * 1 participant
 * Last reply from: [irishnights](https://wordpress.org/support/users/irishnights/)
 * Last activity: [15 years, 10 months ago](https://wordpress.org/support/topic/build-string-from-post-fields/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
