Hi, I would like to include variables into a URL that I am passing to Yahoo Pipes. In the URL below, I would like to have a variable for EndTime (set below to yesterday) and StartDate (set below to 15+days).
http://pipes.yahoo.com/pipes/pipe.run?EndDate=yesterday&StartDate=%2B15+days&_id=84&_render=kml
This URL is being passed in my html code that generates a google map:
var geoXml2 = new GGeoXml(http://pipes.yahoo.com/pipes/pipe.run?EndDate=yesterday&StartDate=%2B15+days&_id=23e0135e18323711db0d9db51ccca684&_render=kml;
If I could assign the EndTime and StartTime to variables, then I could control what comes back from the Yahoo Pipe onto the map. I think php is the right way to do this, but I'm not sure how.
Thanks!
build a URL with variables in it
Moderator: General Moderators
build a URL with variables in it
Last edited by lcp on Fri May 02, 2008 4:21 pm, edited 1 time in total.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: build a URL with variables in it
Code: Select all
echo "var geoXml2 = new GGeoXml('http://pipes.yahoo.com/pipes/pipe.run?EndDate=$enddate&StartDate=$startdate&_id=$id&_render=kml')";(#10850)
Re: build a URL with variables in it
Code: Select all
urlencode("http://pipes.yahoo.com/pipes/pipe.run?EndDate={$enddate}&StartDate=$startdate&_id={$id}&_render=kml");Re: build a URL with variables in it
Also can use the function rawurlencode to bulid it
Re: build a URL with variables in it
Hi, thanks for the help. This is how I solved it:
The code below is in the middle of regular html but the file ends in .php. I guess the browser just reads the page as html. This is set up so that when the URL to the .php page has the variables of start, end, etc in the URL that it populated the Yahoo Pipes URL in the php code:
www.example.com/gmaps.php?start=15&end=yesterday&fname=Joe&lname=Blow&zip=11111
Next step is to figure out how to make a web form that fills the variables. Any ideas?
<?
$enddate = $_REQUEST['end'];
$startdate = $_REQUEST['start'];
$fname = $_REQUEST['fname'];
$lname = $_REQUEST['lname'];
$zip = $_REQUEST['zip'];
echo "var geoXml2 = new GGeoXml(\"http://pipes.yahoo.com/pipes/pipe.run?EndDate=$end&Firstname=$fname&Lastname=$lname&StartDate=%2B$start+days&Zip=$zip&_id=84&_render=kml\");";
?>
The code below is in the middle of regular html but the file ends in .php. I guess the browser just reads the page as html. This is set up so that when the URL to the .php page has the variables of start, end, etc in the URL that it populated the Yahoo Pipes URL in the php code:
www.example.com/gmaps.php?start=15&end=yesterday&fname=Joe&lname=Blow&zip=11111
Next step is to figure out how to make a web form that fills the variables. Any ideas?
<?
$enddate = $_REQUEST['end'];
$startdate = $_REQUEST['start'];
$fname = $_REQUEST['fname'];
$lname = $_REQUEST['lname'];
$zip = $_REQUEST['zip'];
echo "var geoXml2 = new GGeoXml(\"http://pipes.yahoo.com/pipes/pipe.run?EndDate=$end&Firstname=$fname&Lastname=$lname&StartDate=%2B$start+days&Zip=$zip&_id=84&_render=kml\");";
?>