Build a text string from Post Fields
-
Hi,
I’m trying to join some post fields together into a text string (the string will then form the text in a URL which gets sent via an SMS API)
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=”https://www.XXXXXXXX.com/api/send_text.html”;
$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” and no post fields!
Any ideas out there please.
- The topic ‘Build a text string from Post Fields’ is closed to new replies.