PHP - Are There Any Browsers That Can Be Embedded Or Wikipedia Perhaps?
I'm creating a learning tool where people can paste in information and learn about random subjects.
Ideally for a desktop view eg. widescreen, a browser/search engine is on the left, and the interface is on the right.
So I need to embed a browser, I have tried to embed Google but I think, obviously, that they do not permit that.
I have seen possible alternatives like Chromium or Mozilla not firefox, something else "Gecko?"
Anyway, aside from not knowing what a browser is... for example how else can you access a website without a browser, SSH right? But it's about parsing / interpreting the languages correctly...
So what options do I have? Or should I just optimize the website to be used split screen with a browser in a separate tab? (Currently what I'm doing).
Similar TutorialsI tried to parse wikipedia xml api by different methods, but I was unsuccessful Even the curl method did not work Code: [Select] $url = "http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=Wikipedia&rvprop=timestamp|content"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HTTPGET, TRUE); curl_setopt($ch, CURLOPT_POST, FALSE); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_NOBODY, FALSE); curl_setopt($ch, CURLOPT_VERBOSE, FALSE); curl_setopt($ch, CURLOPT_REFERER, ""); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_MAXREDIRS, 4); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; he; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"); $page = curl_exec($ch); $xml = simplexml_load_string($page); print_r($xml); Hi guys. I have been using the wikipedia API to retrieve information about a topic. Ive managed to get a response and retrieve the first section of the topic (in this case football) Using this method - http://en.wikipedia.org/w/api.php?action=parse&page='.$search.'&redirects=1&format=json&prop=text§ion=0'); However the first section that is retrieved includes the pictures and i just want to main text from the introduction. The code that is sent back from wiki is this - Code: [Select] Array ( [parse] => Array ( [text] => Array ( [*] => <div class="dablink">This article is about sports known as football. For the ball used in these sports, see <a href="/wiki/Football_(ball)">Football (ball)</a>.</div> <div class="thumb tright"> <div class="thumbinner" style="width:227px;"><a href="/wiki/File:Football4.png" class="image"><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d2/Football4.png/225px-Football4.png" width="225" height="274" class="thumbimage" /></a> <div class="thumbcaption"> <div class="magnify"><a href="/wiki/File:Football4.png" class="internal" title="Enlarge"><img src="http://bits.wikimedia.org/skins-1.17/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div> Some of the many different games known as football. From top left to bottom right: <a href="/wiki/Association_football">Association football</a> or soccer, <a href="/wiki/Australian_rules_football">Australian rules football</a>, <a href="/wiki/International_rules_football">International rules football</a>, <a href="/wiki/Rugby_Union" class="mw-redirect" title="Rugby Union">Rugby Union</a>, <a href="/wiki/Rugby_League" class="mw-redirect" title="Rugby League">Rugby League</a>, and <a href="/wiki/American_Football" class="mw-redirect" title="American Football">American Football</a>.</div> </div> </div> <p>The game of <b>football</b> is any of several similar <a href="/wiki/Team_sport" title="Team sport">team sports</a>, of similar origins which involve advancing a ball into a goal area in an attempt to score. Many of these involve <a href="/wiki/Kick_(football)" title="Kick (football)">kicking</a> a ball with the foot to score a <a href="/wiki/Goal_(sport)" title="Goal (sport)">goal</a>, though not all codes of football using kicking as a primary means of advancing the ball or scoring. The most popular of these sports worldwide is <a href="/wiki/Association_football">association football</a>, more commonly known as just "football" or "soccer". Unqualified, the word <i><a href="/wiki/Football_(word)" title="Football (word)">football</a></i> applies to whichever form of football is the most popular in the regional context in which the word appears, including <a href="/wiki/American_football">American football</a>, <a href="/wiki/Australian_rules_football">Australian rules football</a>, <a href="/wiki/Canadian_football">Canadian football</a>, <a href="/wiki/Gaelic_football">Gaelic football</a>, <a href="/wiki/Rugby_league">rugby league</a>, <a href="/wiki/Rugby_union">rugby union</a> and other related games. These variations are known as "codes".</p> I want the code that resides in the <p> tags. How would i go about parsing this and removing the rest. ive tried to get to work simple html dom parser but with no luck. Any help would be greatly appreciated Thanks, DIM3NSION Ok, this is killing me, So I'm finally asking for help. I'm working on a website, which streams videofiles from external links. The site plays & allows you to download the videos from the same external link. I need to mask the url of these videos. At the moment, I have successfully masked the url when downloading. If you click the download image, rather than the path being http://externalsite.com/videofile.avi its http://mysitename.com/external.php?id=xx&mid=xx So that is nicely hidden. However, I am having a problem when it comes to the embedded player on the page. At the moment i am using flowplayer for flv & mp4 videos, and just the usual embed for avi videos. Flow players embed code is like this --------------------------------------------------- <a href="<?=$videoFile?>" style="display:block;width:740px;height:400px;" id="player"> </a> <script language="JavaScript"> flowplayer("player", "<?=url::base()?>flowplayer-3.2.5.swf", { clip: { autoPlay: false, autoBuffering: true } }); </script> ----------------------------------------- At the moment, the player only works if i put the url in this format: http://externalsite.com/videofile.avi and wont work in this format http://mysitename.com/external.php?id=xx&mid=xx all download.php does is check the file exists, sets the headers and prompts users to open or save. Why isnt this working with the player? Please see the attached external.php file for my heade info etc to hopefully shed some light on this i want to be able to extract a string from a variable when an IMG tag is present and then use the link of the image to create an image tag of it's own to be displayed let's say i have a string $post which contains the following... (ignoring the quotations) here is some random text ["IMG"]http://www.somedomain.com/someimage.jpg[/"IMG"] here is some more random text how would i be able to extract the string inside the [IMG] tags and replace it with a different string in the same position excluding the [IMG] tags such as <img src=''http://www.somedomain.com/someimage.jpg"/> any recommendations on how i would be able to do this? I found the following forum topic and have implemented the solution provided at the bottom: http://www.phpfreaks.com/forums/index.php?topic=310258.0 Code: [Select] <?php $cnx = fopen("data/Book1.csv", "r"); //open example.csv echo("<table>\n\t<tbody>\n"); // 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 "\t\t<tr>\n"; for ( $j = 0; $j < count($values); $j++ ) { // echo("\t\t\t<td>$values[$j]</td>\n"); } echo"\t\t</tr>\n"; }; echo("\t</tbody>\n</table>"); fclose($cnx); //close filename variable ?> It works great. One question though - - what might it take to add an if/else statement that inserted the following for the first row in the CSV file ... Code: [Select] echo("\t\t\t<th>$values[$j]</th>\n"); ... and inserted the following for every row after the first ... Code: [Select] echo("\t\t\t<td>$values[$j]</td>\n"); This way I can better control my table through CSS. Any ideas? I have a large mysql table with over 2600 rows but only something like 350 unique names. what I'm trying to do is make a HTML table row and select element for every unique name. When the loop encounters a duplicate name, I want it to create new options for all of the duplicate rows. Here is a snippit of my table: Name D01_03 EMS Agency State 10002 Appropriate 2 digit FIPS code D01_04 EMS Agency County 10003 Appropriate 5 digit FIPS code D01_05 Primary Type of Service 5610 911 Response (Scene) with Transport Capability D01_05 Primary Type of Service 5620 911 Response (Scene) without Transport Capability D01_05 Primary Type of Service 5630 Air Medical So names D01_03 & D01_04, should have their own table rows and select elements and D01_05 should just be one row and one select element with all of the entries in their own option tag. The code (partially): $result = mysql_query("SELECT * FROM tblvalues") or die(mysql_error()); //Return the table row by row while($row = mysql_fetch_array($result)) { //Count occurances of element $multi = mysql_query("SELECT count(fldelement) FROM tblvalues WHERE fldelement = \"$row[fldelement]\"") or die(mysql_error()); $multicount = mysql_result($multi, "0"); $icount = $multicount - 1; if ($multicount > 1){ while($row = mysql_fetch_array($result) && $icount >= 0){ //Stuff to do for rows with duplicate names } } else { //Stuff to do for unique rows. } } So, what happens is the outer loop goes until it hits the inner loop, then the inner loop finishes off the remaining rows. i've tried adding a counter to decrement by 1 every iteration of the inner loop, and have it kick out when it hits 0, but that didn't work. Basically, what i think i'm trying to ask is, how do I make the outer loop skip over the lines that the inner loop covered OR how do I make the inner loop kick back out to the out loop when it is done with the duplicates? I'm really sorry for that long, confusing post, but I have been going crazy over this all day, any help would be more than appreciated! Hi folks, I'm using this code to display a picture that is uploaded in a form. Code: [Select] print "<img src='http://www.coast2kosci.com/mylongrun/test/photo_uploads/$imgx' width='300' height='300' alt='Your photo' />"; At first I tried specifying only the width, without the height. But for tall photos, the display wasn't really what I was after. Then I specified both width and height, which results in a mis-scaled photo. Is there any way that I can specify the height and width atributes as a sort of maximum / or limiter. Ie: If the height is greater than the width, limit the height to 300, and if the width is greater than the height, limit the width to 300? Thanks for your time, Dave Hi All, There is a very interesting solved topic here (http://www.phpfreaks.com/forums/index.php?topic=304966.0) about how to access elements in embedded _POST array. But before accessing an element, it might be appropriate to check whether the array it is supposed to be in exists. According to the solution given in the topic indicated above, Code: [Select] $_POST['matType'] is an example of embedded array . Is there a way to check if this array exists? Thanks in advance for your help. PHP = 5.5.14
MySQL = 5.2.17
This simple .php script works as a standalone OK:
<?php require '<snip partial URL>mysqli.php'; // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT `callsign`, `qth`, `submitted` FROM `lqplogs` ORDER BY `callsign`"); echo "<table> <tr> <th><u>CALLSIGN</u></th><th><u>QTH</u></th><th><u>LOG SUBMITTED</u></th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['callsign'] . "</td>"; echo "<td>" . $row['qth'] . "</td>"; echo "<td>" . $row['submitted'] . "</td>"; echo "</tr>"; } echo "</table>"; mysqli_close($con); ?>A separate .html page with other info works by itself OK too, but when I try to embed the PHP script (with PHP start & end tags, of course) *between* these HTML tags: <table> <tr> <td> ... Full PHP Script Embedded here... </td> </tr> </table> I get this mess: "; while($row = mysqli_fetch_array($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; } echo " CALLSIGN QTH LOG SUBMITTED " . $row['callsign'] . " " . $row['qth'] . " " . $row['submitted'] . " "; mysqli_close($con); ?>Any thoughts as to why are appreciated. Thanks! - FreakingOUT I have a video system on my website that allows users to post videos and it embeds youtube videos into the site, I would like to create an interface where you can comment on the actual video itself and it go to youtube's commenting stream. Is that possible? difficult? Hi, i have the following code: where i want the sound to only play during the false part of the IF statement but currently it always plays on every reload, and even if the IF = true any ideas? ive tried autoplay="0" also
Thanks
<embed src="beep.wav" autostart="false" width="0" height="0" id="sound1" enablejavascript="true"> + <script> function PlaySound(soundObj) { var sound = document.getElementById(soundObj); sound.Play(); } </script> + if( isset( $json['Data'] ) ){ echo "<b>Success</b>"; echo "</br>"; echo $data.' x ' .$tqty; echo "</br>"; } else { echo "Error"; echo "</br>"; echo $json['Message']; echo '<script> PlaySound("Sound1"); </script>'; }
i have an admin page that lists all the rows from a table. One of the fields is generated using FCKEditor, so the field has HTML Code in it. I would like to only show the first 100 or so chars of the field, but if the 100 chars ends in the middle of HTML code, specifically in this case <a href>, it cuts off, and creates "havoc" in my page. Is there a way to avoid this by seeing that the 100 char is in the middle of an <a href> tag (or any tag for that matter? Here is what the generated html can look like :: <td class="tdresults">We are very excited to offer three great events at the <a href="http://www.mylongwebsite.c</td> <td class="tdresults">next field data</td> Thank you in advance. Pete I want to place Custom background image for embedded media player Can anyone help me?
Hi! Top Hi If any one has any spare time or is intrigued in any way. I am constructing a website forum like the one you use. This one requires a log on. It works in FF 6.0, Opera Safari and Chrome but not in IE 8.0. I have filled in the passwords(s) extra security. http://www.des-otoole.co.uk/streetangels/ Many thanks if you can work it out. You just need to push the button (login) I have several images created with a Kodak electronic camera and my iPhone. All images are displayed with the correct orientation (portrait or landscape) in the HTML code. The HTML code is wrapped inside a brief PHP code to enable password entry, and the PHP code is uploaded to my Web site along with the images. I have examined the images on my Web site using Web browsers in Windows 10 and Apple MacBook Air. The orientation is incorrect for at least one of the images in each browser -- Internet Explorer, Firefox, Chrome and Safari. Although a majority of the images are oriented correctly, incorrect rotation occurs for some of the phone and Kodak images. I shall provide more information to anyone who can provide me with help and suggestions, which will be much appreciated. Thank you spruce18b
I have a Create new account page. The form is in page named Register.php and once user submit it, it will go to Confirm.php, where it validates the field if everything is correct shows the " Account Created " Message. In Chrome. The error message is shown in Register.php and once all fields are filled then only will show confirm.php. But in Mozilla, it goes to Confirm.php and shows a blank page. My code for Register.php is : Code: [Select] <div class="signup_form"> <form action="confirm.php" method="post" > <?php session_start(); if(isset($_SESSION['error'])) { echo '<p>'.$_SESSION['error']['username'].'</p>'; echo '<p>'.$_SESSION['error']['email'].'</p>'; echo '<p>'.$_SESSION['error']['password'].'</p>'; unset($_SESSION['error']); } ?> <p> <font size="3" face="arial" color="gray"> <label for="username"><b> UserName*</b> </label> </font> <input name="username" type="text" id="username" input style="height:33px" size = "50" size="30"/> </p> <p> <font size="3" face="arial" color="gray"> <label for="email"><b> E-mail Address*</b> </label> </font> <input name="email" type="text" id="email" input style="height:33px" size = "50" size="30"/> </p> <p> <font size="3" face="arial" color="gray"> <label for="password"><b> Password*</b> </label> </font> <input name="password" type="password" id="password" input style="height:33px" size = "50" size="30"/> </p> <p> <input name="submit" type="image" src="images/submit.gif" value="submit"/> </p> </form> </div> and for Confirm.php code is : Code: [Select] <?php session_start(); include('configdb.php'); if(isset($_POST['submit'])) { if($_POST['username'] == '') { $_SESSION['error']['username'] = "User Name is required."; } if($_POST['email'] == '') { $_SESSION['error']['email'] = "E-mail is required."; } else { if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['email'])) { $email= $_POST['email']; $sql1 = "SELECT * FROM user WHERE email = '$email'"; $result1 = mysqli_query($mysqli,$sql1) or die(mysqli_error($mysqli)); if (mysqli_num_rows($result1) > 0) { $_SESSION['error']['email'] = "This Email is already used."; } } else { $_SESSION['error']['email'] = "Your email is not valid."; } } if($_POST['password'] == '') { $_SESSION['error']['password'] = "Password is required."; } if(isset($_SESSION['error'])) { header("Location: register.php"); exit; } else { $username = $_POST['username']; $email = $_POST['email']; $password = $_POST['password']; $sql2 = "INSERT INTO users (username, email, password) VALUES ('$username', '$email', '$password')"; $result2 = mysqli_query($mysqli,$sql2) or die(mysqli_error()); if($result2) { echo '<div>Your account is now active. You may now <a href="login.php">Log in</a></div>'; We are trying to capture customer details & redirecting the customer to payment gateway page and, after succesful transaction from payment gateway we are facing a problem for different browsers. Ideally after successful transaction the page should redirect to order confirmation page but it is redirecting to our cart page.In IE7 it is working fine but in mozilla firefox it is redireting to cart page.On analyzing we found that session is not persisting in firefox. Please help we have stuck here Suggest something if you have faced similar issue with different browsers. |