PHP - Read The Web Page Content Help
I have a php page in which javascript called like this
<script language="JavaScript" type="text/javascript" src="http://www.test.com/test.php"></script> the output of the page shows a well detail table , but when i use file_get_content method to get that all detail in a varaible its just took above javascript like $a=<script language="JavaScript" type="text/javascript" src="http://www.test.com/test.php"></script> when i right click on page to view source it show just <script language="JavaScript" type="text/javascript" src="http://www.test.com/test.php"></script>. But on actual page there is a html table which detail i have to store in table, Can any one tell me method. Similar TutorialsDear, I have page1.php where there is a iframe with source page2.php. How can I read page2.php? Both the pages are in external website, and if I directly point www.thatsite.com/page2.php, it shows blank page (no error). But if I load www.thatsite.com/page1.php in FIREFOX and use SAVE FRAME AS function, it does save page2.php successfully. Thanks, Dear friends, I wrote a code to extract a text from a pages of a site like this: ************ $handle = @fopen($url, 'r'); $contents = ''; if ($handle) { while (!feof($handle)) { $contents .= fread($handle, 8192); } ************ This code is working properly with many pages just pages those are began with the following tags: ************ ... <body> <form name="aspnetForm" method="post" action="ViewContents.aspx?Contract=cms_Contents_I_News&amp%3br=721192" id="aspnetForm"> <input type="hidden" name="__VIEWSTATE" id=" __VIEWSTATE" value="" /> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwL+raDpAgL3qPzdCwLyp86ZD5mqDm6ZnRL/pRerpqyobvzmy5LB" /> ************ The result of function read() in variable $content is not full. It's just theme of the page without main content. I mean there isn't the story related to id of page (e.g. 721192) in the $content. Why? Is the above <form> affected the result? What can i do? Please help me. G'day all, i've got this script that I found on the net some time back but not entirely sure where, however it works well except I want to add a feature so it shows the image details from a txt file. Here is the gallery script: <?php function getDirectory( $path = '.', $level = 0 ){ $ignore = array( 'cgi-bin', '.', '..' ); $dh = @opendir( $path ); while( false !== ( $file = readdir( $dh ) ) ){ if( !in_array( $file, $ignore ) ){ if( is_dir( "$path/$file" ) ){ $dir = $path . $file; echo "<h2>$file</h2><p>"; $dh1 = @opendir( $dir ); while( false !== ( $image = readdir( $dh1 ) ) ){ if( !in_array( $image, $ignore ) ){ if( !is_dir( "$dir/$image" ) ){ if (preg_match("/.jpg/", $image)) { echo "<a href=\"$dir/$image\" rel=\"lightbox\"><img src=\"gallery-thumbnail.php?file=$file/$image\" border=2 style='border-color: #981C1E'></a>\n"; } } } } echo "</p>"; $level++; } } } closedir( $dh ); } getDirectory('gallery/'); ?> Now, what i'm wanting is to read a txt file either in the root or 'gallery' directory, where it has the file name, title, description, photographer. (something like filename.jpg|title of image|description about image|J King). so when the image is displayed, a script reads the text file and will show the image info beside it. Now i've got this bit of snippet from an old script I used once, but can't seem to get it to work anywhere, so any help is greatly appreciated. $text = "gallery.txt"; $fh=fopen($text, "r"); while(!feof($fh)) { $temp = explode("|", $line); $title[$temp[0]] = $temp[1]; $description[$temp[0]] = $temp[2]; $photographer[$temp[0]] = $temp[3]; $line=fgets($fh); unset($temp); } Hello,
I try to get website speed of some website, but i can read only ''domain.com'' i can't read website files like css , js ... why ? i use proxies for this job.
here is the php code:
$options = array( 'useragent' => "Firefox (+http://www.firefox.org)", // who am i 'connecttimeout' => 120, // timeout on connect 'timeout' => 120, // timeout on response 'redirect' => 10, // stop after 10 redirects 'referer' => "http://www.google.com", 'proxyhost' =>'85.25.8.14:80' ); $response = http_get("http://solve-ict.com/wp-content/themes/ict%20theme/js/jquery-1.7.1.min.js", $options , $info);but it works fine with http://domain.com/ , but with files css or js it gives 404, using some free proxy servers available ? Thanks. About a year ago I wrote a mod_rewrite in at sites htaccess file. It was to call a page that queried the database based on a unite code that was assigned to a member. If the member was assigned a code that was FL1001, the URL www.marketingteammates.com/FL1001 would bring up a page that quaried that member and displayed their database content.
In the users table of the site, it quaried the field webPageID and the information was called. It called a page webpage.php that quaried the info. The URL in the address bar still displayed www.marketingteammates.com/FL1001. Here are the lines of code in the htaccess file.
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z])([A-Za-z])([0-9]+)$ /webpage.php?webPageID=$1$2$3 [NC,L]I now have a second page completely different from the webpage.php. It is a page storeNumber.php and would query a field storeNumberID. This field could contain any kind of string such as Store#101, or mystore101, or #101 is my store. I tried using the same rewite rule just replaceing the webpage.php and variable with storeNumber.php and $storeNumberID. This doesn't work. It also leads me to wonder if there can even be two different pages in the mod_rewrite. How would it diferentiate one from the other. Thanks for any help in advance. Mike Trying to get this done: Page_1 has many external links, when certain links are clicked i do not want user to go directly to page, but rather go to a special add page_2 where user must click a second time on the link to finally get there. The add page_2 must show on screen the name of the initial link from page_1, it must change accordingly with the link it came from page_1,once on page_2 the hyperlink redirects outside the site. So far i am thinking give an id to the div or "<a href..." on page_1 then somehow have page_2 detect that id and fill in the variable for the final external link. Other wise is there a way to detect a url from incoming? I guess a similar example is how some domain name sellers landing page will indicate the name of the site. Such as "Thisdomain.com" is for sale. same landing page but the name changes according to the domain that was typed. Hi every one I want to share a page content(or an article) into my facebook page via php . How should I do that ? Thanks Currently, in my files, I echo content through either a function called error() or a funtion called info(). Each function has 3 require statements for the header, body and footer files and that is all that is contained in the function. What I want to do is, if error() is called, is kind of leave the script and exit it. Surprisingly I have used exit; at the end of the functions to stop any more of the script being executed. Is this the best way of doing it? Hello. I am attempting to display content from a database to a web page. I have SELECT * etc to do this, plus the menu that should be displayed has links to pages. This would display text to the page depending on the link, for this to work I use the id of the page ($Get['id']). Following advice (not code), I have attempted the following:
<!DOCTYPE html> <html> <?php include 'includes/headsection.php'; ?> <body> <?php // query database if (!empty($_GET['id']) && (intval($_GET['id']) == $_GET['id'])) { $pdo_statement = $conn->prepare("SELECT * FROM pages WHERE id=:id ORDER BY id ASC"); $pdo_statement->execute(['id' => $_GET['id']]); $result = $pdo_statement->fetchAll(); } ?> <!-- topMenu --> <table id="topMenu"> <tr> <td><h1 class="siteName">Site name</h1></td> <td> <?php if(!empty($result)) { foreach($result as $row) { ?> <a href="index.php?id=<?php echo $row['id']; ?>"><?php echo $row['menuheader']; ?></a> <?php } } ?> </td> </tr> </table> This issue is that the top menu (home, etc), does not appear, and there are no errors to suggest what I have done wrong. Any help will be appreciated. I include a picture of what I mean. There should be Home | other | etc...
What I'm trying to do is get a php file with content to load into my basic page template based on the page id, however it's not loading anything, however there are no errors coming up. I've looked everywhere I could find, and tried everything I could think of. I really could use some help on this. Below is the page template code and the code I'm trying to use to get the content to load up. page_templ.php Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > <link rel="stylesheet" type="text/css" href="templates/content/style.css" > <!--This is the css used for IE because we need to correct some things for it.--> <!--[if IE]> <style type="text/css"> @import 'templates/content/styleIE.css'; </style> <![endif]--> </head> <body> <?php //We need to load our language files with our common text varibles require("content/langeng.php"); ?> <div id="header"> <? //Lets show the header. I use html where I can so smartphones load as little advanced code as possible require_once("header.php"); ?> </div> <div id="menu"> <?//Now our menu. require_once("menu.php"); ?> </div> <div id="mbody"> <?//Now the primary site content. //Load up our postvars.php file require_once("content/postvars.php"); ?> </div> </body> </html> postvars.php Code: [Select] <?php $id = $_POST["id"]; if ( $id == "home" ) { include 'main_c.php'; } elseif ( $id == "guides" ) { include 'guides_c.php'; } elseif ( $id == "trips" ) { include 'trips_c.php'; } ?> Most of the websites I have built have not been large and not dynamic in nature, but I need to make one now with a boatload of content on it. and I’m needing a little resource help where I can research something. I’m sure all developers do this, and I know I need a massive database or 2 and the PHP knowledge I already have, but I’m just looking for a little guidance about how to do this the easiest way. It may actually sound like a stupid question and I might be over-thinking a bit. So… Lets say I have 500 articles that I want to make available to a site visitor and give them the option to choose what they want to look at through nav menus and submenus. I want the same page to display to the user, regardless of what article is chosen. how does PHP play a part in that? Would I be right by saying the following? If the home page had this content on it: This website is a course in PHP coding. <a href="courseTemplate.php" target="_blank">Click here</a> to view course #1. and I wanted all the course content to be displayed through the use of the “courseTemplate.php” file, how simple is that? I would assume that these types of things would be the results and the techniques to accomplish the goal, right? => a resulting URL that looks like this: www.site.com/courseTemplate.php?id=1 => storing all the text of the course material in one single field of a DB record. NOT storing the layout-oriented code (HTML, etc.) and echoing it out with the rest of the text. => making use of the GET() function somehow to pull the course’s text content out of the database. Can someone show me a website that demonstrates this? I don’t think this is very difficult, and I’m sure there are web resources available that show how this is done. I’m almost sure that most news agency websites do this, and I know for a fact that most forum software has this template technique written into it, regardless if SEO is included or not. Sorry for the basic nature of this question. I know some of my previous posts have been such where I’ve asked much more difficult questions than this. I have seen youtube tutorials on issues similar to this, but nothing pulled up by google really shows this in a very simplistic nature. thanks. Good day everyone! I know this is possible but I do not know how to do it. I have a single page, this page has no dynamic content. I have a set of links. What I need is to have content placed on the page based on the link the user clicks. Example: I have pictures of animals. When the user click a Zebra, the Zebra info is placed on the page. So the page does not change, meaning the content on the page changes but not the page it self. The idea is instead of creating different html pages for each animal profile, the profile is generated to the page from a php include file. Is is this possible? Can anyone, some one please point me to how I can get this going. Thanks everyone! IC I'm doing a cURL post to a server and it returns "true No_Error Data was accepted 10356546 3770 false 0 " Form --> Method=Post --> submit.php (this is the page that's doing the cURL post and the server returns data that appears on this page). How do I take this and put it into a string? http://buildmyweb.org/testing/starter/
at the link above, you can see a test-page. the problem im having is that the content in the footer gets cutoff on the right side of the footer when viewed in an ipad. id love to hear it if anyone can figure out why
here is the html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="keywords" content = "Under Construction" /> <meta name="description" content="is currently Under Construction." /> <title>Under Construction</title> <link rel="stylesheet" type="text/css" href="bmw_footer_abs.css" /> </head> <body id="page_home"> <div id="wrapper"> <div id="banner"> </div> <!-- close banner --> <div id="main"> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> <p> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p> </div> <!-- close main --> </div> <!-- close wrapper --> <div id="footer"> <div id="footer_content"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> <!-- close footer_content --> </div> <!-- close footer --> </body> </html>and the css: html { position: relative; min-height: 100%; } body { margin: 0 0 100px; /* bottom = footer height */ } #footer { position: absolute; left: 0; bottom: 0; height: 100px; width: 100%; min-width:1000px; background:gray; } #wrapper { position:relative; top:0px; margin:0 auto; width:1000px; text-align:left; background:pink; padding:0px; } /* **************** BANNER *************** */ #banner { float:left; background:green; width:100%; height:10px; } /* **************** MAIN *************** */ #main { float:left; width:100%; background-color:#f0f3f8; } /* **************** FOOTER *************** */ #footer { font-size:85%; line-height:1.3; } #footer_content { width:1000px; margin:0px auto; background:orange; } I got a question im using izabi for me im one who loves the software. But there some quirks that they forgot to add when making the mail system. I was wondering how it would be possible to code in a peice of php where it says read after someone read the email. If you need a copy of the mail mail script let me know. Hello! I would like to use cURL to login to the website: lockerz.com I have some code, but it doesn't seem to work: <?php // INIT CURL $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch, CURLOPT_URL, 'http://lockerz.com/auth/login'); // ENABLE HTTP POST curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, 'email-email=EMAIL@hotmail.com&password-password=PASSWPRD'); // IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES curl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); # Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL # not to print out the results of its query. # Instead, it will return the results as a string return value # from curl_exec() instead of the usual true/false. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); // EXECUTE 1st REQUEST (FORM LOGIN) $store = curl_exec ($ch); // SET FILE TO DOWNLOAD curl_setopt($ch, CURLOPT_URL, 'http://lockerz.com/auction'); // EXECUTE 2nd REQUEST (FILE DOWNLOAD) $content = curl_exec ($ch); // CLOSE CURL curl_close ($ch); echo $content; ?> Thank you very much if you can help! Hello! I have my own framework through which all modules are loaded and content is stored in specific class. At the end all the content is displayed on screen. I'm stucked at this last step when I want with php function (print or echo) to display the contents of all pages on screen. Then the server obviously can't handle this, because after a few clicks page hangs (stops responding - until I close the browser and reopen the page). Maybe are there some restrictions on server? Page is loading on other server just fine (that other server is a little bit faster). it' online shop with lots of html code (that's the only difference between pages that works and this one that hangs!) Any ideas? Hi there, I have updated a webpage and it appears that some users are still seeing the older version of the page. Is there a way I can force the user's version of the page to display the latest content on the page? I have see I can add some meta tags which control the cache, but my site relies quite heavily on cookies, so I guess clearing the cache would reset/have an effect on the cookies? Does anyone have any ideas on how I can make users always see the latest content? Thanks! Hi, I've done some serious google'ing... I'm all googled out and it doesn't appear there is a solution to this the way I'm attempting it and it's probably more a case of my early ventures into development that I'm missing something that may or may not be a better and if not more obvious way to do this... Here's the principle, Customer Logs into webpage - greeted by profile page (all cushty so far) - Can choose to move to view 'audio files' which relate to the products they have purchased (this is where it gets silly...) The idea is that both the profile page and the audio page are controlled by a $_SESSION within PHP scripting so the pages are dynamic. I want to include all of the audio files for every product on the 'audio.php' page BUT I only want the ones that they have purchased to be visible... All the setup is fine because the following works fine: Code: [Select] if($info['halftimerock'] == 1) { echo "<p>Half Time Rock</p>";} Which essentially checks the db, finds a 1 in the appropriate product and displays the name of the product in a list, if no products then nothing in the list etc. What I want to do is control the visibility of some <div>'s using the same kind of idea, so: Code: [Select] if($info['halftimerock'] == 1) { CODE TO DISPLAY DIV IN HERE } I have a 'toggleelement' JS function available which works for mouse clicks but obviously php and js don't exactly go well together so that is probably not the way to go, I'm already running a lot of PHP at the top of the page before the HTML to stop session header errors. A couple of web searches have suggested I insert a <script> tag into the echo command but I can't get that to work and I guess it's a really messy way of trying to do things! So here's the question, any ideas about how to toggle <div> visibility within php or is that purely something for js to handle?... Is there a better/cleaner way of doing it all, perhaps redirecting users to different pages based on their entries in the DB (which could all be handled with headers but I'll end up with a million different pages and combinations eventually? I could always create a .htaccess/.htpasswd file system and handle the folders with audio content in manually so that all files are visible but only a valid username and password will be able to access the file but that's going to get annoying for people having to put in user/pass for every file and also for me updating the users for each individual file every time some1 buys something... Any ideas? Anybody done anything similar? Cheers This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357949.0 |