liamloveslearning Posted February 6, 2009 Share Posted February 6, 2009 basically, ive got a html form that posts a GET request to a PHP file. what i want to do is to take the search query from the form and include it somehow onto the end of a URL. i just cant figure out how to add the search query onto the end of the URL in the PHP file <?php $mm_xsl = new MM_XSLTransform(); $mm_xsl->setXML("http://gdata.youtube.com/feeds/api/videos/-/Music?max-results=8&orderby=relevance&vq=foo+fighters"); $mm_xsl->setXSL("video_feed.xsl"); echo $mm_xsl->Transform(); ?> so where it says foo fighters on the end, id like it to be replaced with whatever the search result was Link to comment https://forums.phpfreaks.com/topic/144068-get-data-from-url/ Share on other sites More sharing options...
jamesxg1 Posted February 6, 2009 Share Posted February 6, 2009 basically, ive got a html form that posts a GET request to a PHP file. what i want to do is to take the search query from the form and include it somehow onto the end of a URL. i just cant figure out how to add the search query onto the end of the URL in the PHP file <?php $mm_xsl = new MM_XSLTransform(); $mm_xsl->setXML("http://gdata.youtube.com/feeds/api/videos/-/Music?max-results=8&orderby=relevance&vq=foo+fighters"); $mm_xsl->setXSL("video_feed.xsl"); echo $mm_xsl->Transform(); ?> so where it says foo fighters on the end, id like it to be replaced with whatever the search result was <?php $mm_xsl = new MM_XSLTransform(); $mm_xsl->setXML("http://gdata.youtube.com/feeds/api/videos/-/Music?max-results=8&orderby=relevance&vq=$searchresults"); $mm_xsl->setXSL("video_feed.xsl"); echo $mm_xsl->Transform(); ?> and use a for to do so <input type="text" name="searchresults" id="$searchresults"> Link to comment https://forums.phpfreaks.com/topic/144068-get-data-from-url/#findComment-755920 Share on other sites More sharing options...
omfgthezerg Posted February 6, 2009 Share Posted February 6, 2009 you should use urlencode for the post data. Link to comment https://forums.phpfreaks.com/topic/144068-get-data-from-url/#findComment-755935 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.