PHP - Embed Google Map
Hello to all. Please I need your help.
I have a web site (php, mysql, dreamweaver) with some seller info in a db table. They want to show a google map with their location of address, that have in the db. Let's say:
Field: Data:
tbAddress 22 Kastelliou street
tbPO 11141
tbLocal Athens
tbCountry Greece
I am try with these iframes that google has on site but this embed is ONLY for what i will find through the address bar. The dynamic web page I have, has the info of the seller (who, where, what) and I want this map dynamically change location, according to the address of the seller from the fields I provided.
Thank you
Similar TutorialsHi guys, I have a question, I realised that when I type in my url, for example, www.abc.com, it will automatically lead to www.abc.com/index.php URL, I would like to remain the URL as www.abc.com. How do I achieve that? Thanks Wilson Hello - I'm (very) new to php and working on a project and wondering if anyone can point the direction? (Not necessarily give the answer, but any helpful direction). I need to take YouTube video id's, (built into an array), and post the various video clips. Also the <object> code is in an php array. (Code Below.. hard to explain). Do I need to convert the array text into a string (as shown), and how do I take that string text and paste it into multiple youtube object posts? Note that the original $embedCode is commented out, '//), so that it can be referenced. Any advice is appreciated! <?php $number = 0; $youtubeIds = array("MX0D4oZwCsA","2v-v3jh-Cco","WuYDSa4BRaw","zwo48StJSr4","exOxUAntx8I"); // $embedCode = '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/__YOUTUBE_ID__?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/__YOUTUBE_ID__?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>'; $string = implode($youtubeIds); $embedCode = '<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/'<?php $string?>'?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'<?php $string?>'?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/"> <head> <title>Youtube Videos</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="language" content="en" /> </head> <body> <h1>Youtube Videos</h1> <p><?php for($i = 0; $i < count($youtubeIds); $i++) { echo $embedCode; } ?> </p> </body> </html> I need to echo out a database value that contains an embed code for soundcloud (music hosting site), into a value of a text input. How do I do this without the object getting rendered? This is an example of an embed code. <object height="81" width="100%"> <param value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fgeneralpie%2Fdukebox001&secret_url=false" name="movie"> <param value="always" name="allowscriptaccess"> <embed height="81" width="100%" type="application/x-shockwave-flash" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fsoundcloud.com%2Fgeneralpie%2Fdukebox001&secret_url=false" allowscriptaccess="always"> </object> The value has to stay exactly the same so that it can pass a regular expression for validation. Is this possible? I tried searching google and phpclasses.org for something of this nature, but can't seem to come across anything. (or possibly using the wrong keywords). Basically I am looking for a class that I can instantiate with a URL (or similar), and in turn it will provide me with the appropriate embed code for that video along with a thumbnail. (Thumbnail optional) I currently having something im using, but its restricted purely to YouTube, and wish to expand it to all video providers. Does anyone know of any code available (class) that can provide me with what I mentioned above. Thanks hi all is there anyway embedding excel or .csv files to the webpage other than the folowing two options . saving it as a webpage . using google docs i used the following code, iam getting the .csv file in the page, but it would be good to have the color formatting, bold, italics... also in the webpage. is it possible? Code: [Select] <?php $cnx = fopen("example.csv", "r"); //open example.csv echo("<table style='border:1px solid #ddd;'>"); // echo the table while (!feof ($cnx)) { // while not end of file $buffer = fgets($cnx); // get contents of file (name) as variable $values = explode(",", $buffer); //explode "," between the values within the contents echo "<tr>"; for ( $j = 0; $j < count($values); $j++ ) { // echo("<td style='border:1px solid #ddd;'>$values[$j]</td>"); } echo"</tr>"; }; echo("</table>"); fclose($cnx); //close filename variable ?> Hey all - Below is my code. I'm uncertain how to move correctly code (syntax) what I'm looking to do.. When the user clicks "Next" or "Previous," the following youtube clip will load into the div tag. (With the corresponding description tag). Where do I incorporate the str_replace? And how do I make sure both the youtube clip with the correct description is loaded? Any advice is appreciated! <?php $youtubeIds = array("rHNtuaVHenM","zIAdbIMNq9g","QQ4TlJLa-n4","JccPOA12ELI","JccPOA12ELI", "TWhhXVqVB7E"); $embedCode = '<object width="853" height="505"><param name="movie" value="http://www.youtube.com/v/__YOUTUBE_ID__?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/__YOUTUBE_ID__?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="853" height="505"></embed></object>'; if(isset($_GET['youtubeclip'])) { if(is_numeric($_GET['youtubeclip'])) { if($_GET['youtubeclip'] >= 0 && $_GET['youtubeclip'] <= 5) { $youtubeclip = $_GET['youtubeclip']; } else { $youtubeclip = 0; } } else { $youtubeclip = 0; } $prevyoutubeclip = $youtubeclip-1; if($prevyoutubeclip < 0) { $prevyoutubeclip = 5; } $nextyoutubeclip = $youtubeclip+1; if($nextyoutubeclip > 5) { $nextyoutubeclib = 0; } $clip_names= array('Episode #1', 'Episode #2', 'Episode #3', 'Episode #4', 'Episode #5', 'Episode #6'); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Billy Green</title> <link rel="stylesheet" type="text/css" media="screen" href="episode_style.css"> </head> <body> <div class="wrapper"> <?php include 'header.php'?> <div id="episode_content"> <div class="youtube_box"> <?php echo $embedCode; ?> </div> <h2 class="clip-description">"<?php echo $clip_names[$youtubeclip]; ?>" </h2> <div class="youtube_control"> <a href="episodes.php?youtubeclip=<?php echo $prevyoutubeclip; ?>"> Previous Clip </a> <a href="episodes.php?youtubeclip=<?php echo $nextyoutubeclip; ?>"> Next Clip </a> </div> </div> <div class="clearIt"> </div> <?php include 'footer.php'?> </div> </body> </html> I have an excel file that I want to show in PHP page. I dont want this to first download and then view. I want it something like gmail where you just click on the file name and it opens up. Can you please give me an idea as how to do this. Regards, Faisa i know you get embed code from youtube videos. How do i put the code into my website. Do i store the code in mysql? and how do i get php to display it? hey guys, what i have done so far is got the link to a bbc video feed so when you go to my site the php code will retrive the latest video from bbc and get the link. so i now have $url as having the value of the video but i now need to insert it into the html embed video code. so how can i make this. Code: [Select] <object width="416" height="374" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="ep"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="wmode" value="transparent" /><param name="movie" value="http://i.cdn.turner.com/cnn/.element/apps/cvp/3.0/swf/cnn_416x234_embed.swf?context=embed_edition&videoId=world/2009/06/28/penhaul.lok.honduras.cnn" /><param name="bgcolor" value="#000000" /><embed src="http://i.cdn.turner.com/cnn/.element/apps/cvp/3.0/swf/cnn_416x234_embed.swf?context=embed_edition&videoId=world/2009/06/28/penhaul.lok.honduras.cnn" type="application/x-shockwave-flash" bgcolor="#000000" allowfullscreen="true" allowscriptaccess="always" width="416" wmode="transparent" height="374"></embed></object> http://ahy4life.com/test2/press.php I am following the tutorial below: http://www.adambate.com/how-to-add-a-flickr-based-photo-gallery-to-your-website-phpflickr-lightbox/ I am encountering errors when I introduce the code below. Not sure what is causing it. The flickr photo set is named 'AHY' . php and js <CODE> <script type="text/javascript" src="photos/lightbox2.05/js/prototype.js"></script> <script type="text/javascript" src="photos/lightbox2.05/js/scriptaculous.js?load=effects,builder"></ script> <script type="text/javascript" src="photos/lightbox2.05/js/lightbox.js"></script> <?php require_once("photos/phpFlickr-3.1/phpFlickr.php"); $f = new phpFlickr("b16911dd0ec59f16ed66e80711edbdaf"); // API $user = "ahy4l@yahoo.com"; $ph_sets = $f->photosets_getList($user); ?> </CODE> <CODE> <!-- Photo Gallery --> <div id="gallery"> <?php foreach ($ph_sets['AHY'] as $ph_set): ?> <div class="photosets"> <p><h2><?php print $ph_set['title']; ?></h2></p> <?php $photoset_id = $ph_set['id']; $photos = $f->photosets_getPhotos($photoset_id); foreach ($photos['AHY']['photo'] as $photo): ?> <div class="photos"> <a rel="lightbox[]" href="<?= $f->buildPhotoURL($photo, 'medium') ?>" title="<?= $photo['title'] ?>"> <img src="<?= $f->buildPhotoURL($photo, 'square') ?>" alt="<?= $photo['title'] ?>" title="<?= $photo['title'] ?>" /> </a> </div> <?php endforeach; ?> </div> <?php endforeach; ?> </div> The CSS I use for this is: #gallery { position: relative; float: left; width: 600px; padding: 0px 15px 10px 15px; } .photos { position: relative; float: left; display: block; padding-bottom: 10px; } .photosets { clear: both; padding-top: 1px; } .photosets h2 { color: #000; } </CODE> Hi guys, In an application I'm working on, I'm looking to embed a youtube video with [YOUTUBE][/YOUTUBE]. Code: [Select] echo preg_replace('#(?:<\>]+href=\")?(?:http://)?((?:[a-zA-Z]{1,4}\.)?youtube.com/(?:watch)?\?v=(.{11}?))[^"]*(?:\"[^\<\>]*>)?([^\<\>]*)(?:)?#', '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'.$matches[2].'"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'.$matches[2].'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>', $ENTIREPAGE?); The problem is that the video appears with a slider control at the bottom. How do I get rid of the Youtube slider control at the bottom? Thanks. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=332275.0 Ok I have a unique issue I have a decent sized database for a fix up and modify project I just landed. My problem is my client has a table with plain html, flash, javascript it in. Which generally speaking isn't to much a problem if I we're going the straight php route to get the data from the database. However I'm not so lucky. These people wish to have the element being built by me to use AJAX to give the site a "2.0" feel, which again to a point fine. So all this said and done, I am going using jQuery as my frame for the javascript. The landing page for the script is PHP it handles any potential user input checks before it works its way into the javascript variables to then use JSON through the javascript to another php file which in turn double checks the inputs just incase someone wants to go in to the source find the way to the file its gathering the data from an all else. Then based on the data forms its output. Which I don't know why Ive wasted my time explaining that, we all know how JSON works in concept at least. My issue with this all is, a single column or 2 but ill stick with just the one for now... with these people having stored plain html, javascript, and object tags for flash in the column without any htmlspecialchars or stripslash's or really any security per say in mind. In other words I can go into any column and just copy and paste the code and have it work in an HTML file as if it were typed out for use in HTML alone. So with that, my JSON requests are failing due to the extra quotes, double quotes, slashes, and all else. What I am trying to figure out is, what is my best method to phrase the output of the DB so its friendly for for the JSON request yet can be repieced back together via javascript/jquery. Any takers on that idea? This is a section of my code that goes and gets videos from any video site. What I’m having issues with is having it post a random title, that are all in a text file called titles.txt. What I’m wanting to accomplish is have my script go pull the video embed code, the duration, the tags, etc. Which all works fine until I get to the title part where it pulls locally from the server from the text file. I'm not an advance programmer so not sure if I am even approaching this correct way. Here is the code I have that is responsible for putting the title in. I appreciate your help. $video = array( ‘user_id’ => $this->user_id, ‘status’ => $this->status, ‘site’ => ‘my site’, ‘id’ => ‘’, ‘embeddable’ => true, ‘url’ => ‘’, ‘titles’ => ‘’, ‘title’ => ‘’, ‘description’ => ‘’, ‘tags’ => ‘’, ‘category’ => ‘’, ‘thumbs’ => array(), ‘duration’ => 0, ‘embed’ => ‘’ ); function random_title () { $titles = file (“titles.txt”, FILE_IGNORE_NEW_LINES); $num = rand (0, intval (count ($titles) / 3)) * 3; return ucwords($titles[$num]); } //Title if(preg_match(’/title="(.*?)"/’, $match, $matches_title)) { $video[‘title’] = random_title(). ’ - My site name’; } else { $this->errors[] = ‘Failed to get video title for ‘.$video[‘url’].’!’; if (!$this->debug) continue; else $debug_e[] = ‘TITLE’; }
Hi friends i have latest rss news feed im my php site, i would like to share latest 5 rss feed so some of our partners can publish in thier site . How to do it ? I am looking for a code where I can get a video URL from Youtube, Vimeo, Facebook and convert it to an embedded video to be shown on my site. I found a script that does that. It works fine. The only errors I get are in the inspect element window in the browser. Errors such as this. Failed to load resource: net::ERR_BLOCKED_BY_CLIENT googleads.g.doubleclick.net/pagead/id:1 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT static.doubleclick.net/instream/ad_status.js:1
This is the function to generate the embedded videos. Do the above errors matter if the videos show up and play fine? function generateVideoEmbedUrl($url){ //This is a general function for generating an embed link of an FB/Vimeo/Youtube Video. $finalUrl = ''; if(strpos($url, 'facebook.com/') !== false) { //it is FB video $finalUrl.='https://www.facebook.com/plugins/video.php?href='.rawurlencode($url).'&show_text=1&width=200'; }else if(strpos($url, 'vimeo.com/') !== false) { //it is Vimeo video $videoId = explode("vimeo.com/",$url)[1]; if(strpos($videoId, '&') !== false){ $videoId = explode("&",$videoId)[0]; } $finalUrl.='https://player.vimeo.com/video/'.$videoId; }else if(strpos($url, 'youtube.com/') !== false) { //it is Youtube video $videoId = explode("v=",$url)[1]; if(strpos($videoId, '&') !== false){ $videoId = explode("&",$videoId)[0]; } $finalUrl.='https://www.youtube.com/embed/'.$videoId; }else if(strpos($url, 'youtu.be/') !== false){ //it is Youtube video $videoId = explode("youtu.be/",$url)[1]; if(strpos($videoId, '&') !== false){ $videoId = explode("&",$videoId)[0]; } $finalUrl.='https://www.youtube.com/embed/'.$videoId; }else{ //Enter valid video URL } return $finalUrl; }
The first part of this project was to pull a pdf file which was stored securely on the server into the browser for a user to look at it, but not long after the client asked if I could move the pdf down a bit and put a close button in.
Didnt think anytihng of it until I tried and it wasnt so easy, as the pdf always took over the full screen and I couldnt get it to recognise a div i placed on the page.
So have tried doing it the way below, which has sort of worked but I get a not as pdf error alert.
The user clicks a link to get the page below
<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>utgroup admin</title> <meta content="text/html; charset=utf-8" http-equiv="Content-type" /> </head> <body> <div style="position:relative; width:100%; height:30px; background-color:#FF0000; margin-bottom:40px; clear:both;"></div> <object data="spdf.php" type="application/pdf" width="100%" height="100%"> <p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href="myfile.pdf">click here to download the PDF file.</a></p> </object> </body> </html>Inside that I placed an object to try and pull the other page through which is creating the pdf, but its not quite working, any suggestions. session_start(); require_once('../auth.php'); include "../config.php"; error_reporting(E_ALL); ini_set('display_errors','On'); if(isset($_GET['pdf'])) { $stock_Id=$_GET['pdf']; $a=mysql_query("select Document from Documents where ID=$stock_Id") or die (mysql_error()); while($s=mysql_fetch_assoc($a)){ $cdocdocb=$s["Document"]; } } $file="$cdocdocb"; header('Content-type: application/pdf'); header('Content-Disposition: inline; filename="$file"'); @readfile($file); //echo "<p>$file</p>"; ?> Hi guys Mods please move if this is the wrong place to ask. I have a google maps api added to my web site but i want to be able to position "pins" on the map to show all the the registered clubs in an area... eg the user searches dublin and all teh clubs pop up... My question is.. is there anyway to do this without needing the user to supply the long/lat.. ie can it be gotten automatically?? I really just want it to work off the addrees/area they supplied when they registered. thanks tt Hi all i was wondering if someone with exp in youtube api could help me out with this I have a website where i want to let people subscribe to others and first off i auth the user Code: [Select] session_start(); set_include_path('path'); require_once 'Zend/Loader.php'; // the Zend dir must be in your include_path Zend_Loader::loadClass('Zend_Gdata_YouTube'); $yt = new Zend_Gdata_YouTube(); Zend_Loader::loadClass('Zend_Gdata_AuthSub'); function getAuthSubRequestUrl() { $next = 'my site'; $scope = 'http://gdata.youtube.com'; $secure = false; $session = true; return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session); } function getAuthSubHttpClient() { if (!isset($_SESSION['sessionToken']) && !isset($_GET['token']) ){ echo '<a href="' . getAuthSubRequestUrl() . '">Login!</a>'; return; } else if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) { $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']); } $httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']); return $httpClient; } And that takes me to the page to auth my account, then when i go back to my website and hit the sub button that i made Code: [Select] <?php $username = $_SESSION['username']; include("connect.php"); $mysql = mysql_query("SELECT * FROM users WHERE username = '$username'"); while($row = mysql_fetch_assoc($mysql)){ ?> <table> <tr><td> <?php echo $row['channel']; ?> </td></tr> <tr><td> <form action="sub4sub.php?id=<?php echo $row['id']; ?>" method="POST"> <input type="submit" name="i" value="Sub"> </form> </td></tr></table> <?php } if (isset($_POST['i'])){ $id = $_GET['id']; $sql = mysql_query("SELECT * FROM users WHERE id= $id"); $row = mysql_fetch_assoc($sql); $ytkb = $row['channel']; // this example assumes that $yt is a fully authenticated service object getAuthSubHttpClient(); $subscriptionsFeedUrl = "http://gdata.youtube.com/feeds/api/users/default/subscriptions"; $newSubscription = $yt->newSubscriptionEntry(); $channel = $ytkb; $newSubscription->setUsername(new Zend_Gdata_YouTube_Extension_Username($channel)); // post $yt->insertEntry($newSubscription, $subscriptionsFeedUrl); } ?> So should be subscribing to the persons channel that is displayed in the table, but i get this errors Quote Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 401 <HTML> <HEAD> <TITLE>User authentication required.</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>User authentication required.</H1> <H2>Error 401</H2> </BODY> </HTML> ' in /home/u292976682/public_html/Zend/library/Zend/Gdata/App.php:709 Stack trace: #0 /home/u292976682/public_html/Zend/library/Zend/Gdata.php(221): Zend_Gdata_App->performHttpRequest('POST', 'http://gdata.yo...', Array, '<atom:entry xml...', 'application/ato...', NULL) #1 /home/u292976682/public_html/Zend/library/Zend/Gdata/App.php(900): Zend_Gdata->performHttpRequest('POST', 'http://gdata.yo...', Array, '<atom:entry xml...', 'application/ato...') #2 /home/u292976682/public_html/Zend/library/Zend/Gdata/App.php(975): Zend_Gdata_App->post(Object(Zend_Gdata_YouTube_SubscriptionEntry), 'http://gdata.yo...', NULL, NULL, Array) #3 /home/u292976682/public_html/sub4sub.php(123): Zend_Gdata_App->insertEntry(Object(Zend_Gdata_YouTube_Subscrip in /home/u292976682/public_html/Zend/library/Zend/Gdata/App.php on line 709 Any help would be great thanks I'm having trouble loading this kind of KML with PHP http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_protocol.html#RetrievingFeatures example <atom:entry xmlns='http://www.opengis.net/kml/2.2' xmlns:atom='http://www.w3.org/2005/Atom' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gd='http://schemas.google.com/g/2005'> <atom:id> http://maps.google.com/maps/feeds/features/userID/mapID/full/featureID</atom:id> <atom:published>2008-08-14T17:46:06.462Z</atom:published> <atom:updated>2008-08-14T18:12:31.589Z</atom:updated> <atom:category scheme='http://schemas.google.com/g/2005#kind' ..... it seems like the column in atom:entry, etc is causing this. $response = simplexml_load_string($response); print_r($response); the above just gives an empty SimpleXMLElement Object() Any ideas |