HTML Header Based Extraction
I consider myself pretty proficient in PHP I have written a number of high quality database driven websites in PHP but I am having trouble with what I am trying to do now. I have a variable filled with HTML data that will look something like this. Code:
Blah blah blah
<h1>Whubba</h1>
<h2>ROFL</h2>
This is a test
<h2>OMG</h2>
Yep, it's a test
<h1>LOLZ</h1>
No! It's not!
but there is no particular order, LOLZ could be before Whubba and OMG could be before ROFL. In some cases LOLZ, OMG, or ROFL may not even be there. Only a few things are certain, the level 1 header Whubba will always be there. If ROFL and OMG are present they will always be after Whubba but before any other level 1 headings that follow Whubba and they will always be level 2 headings.
So I need to extract the content of ROFL and OMG up until the next heading (it could be another h2 or a h1) and save that information in a variable, one for ROFL and one for OMG. How would I do this?
View Complete Forum Thread with Replies
Related Forum Messages:
Image Based On Header
It's an interesting service, you pass an url to its cgi and you get a thumbnail of that url. Of course they don't have the screenshots of all the websites so I have to check if the image returned is fine or not. This is not that problematic, I can read the headers and understand if it is a jpg or a gif (the error one). The problem that I have is that sometimes although they have the screenshot in the database they return the error one. For different reasons I thought to backup once on a while the thumbs that I need. So the procedure should be something like this: - query the cgi - check if it is a correct image - if it is, backup it
View Replies !
Browser Based Header Info
I am using Header("Content-Type:application/rss+xml"); it works fine with Firefox 2.0Â not with IE and If i use only Header("Content-Type:text/xml"); it works fine with IE not Firefox. SO any way to solve this?
View Replies !
PHP-based HTML Validator
anyone know of a good PHP-based HTML validator? something that resembles what they have at W3C, or maybe something that can point out obvious syntax errors and tag typos.
View Replies !
Web Based HTML Email Client
I have successfully built a web based email client that supports HTML. The question I have for you is why do I get "3D", "=" with a carriage return, "=A0", "=20", "=09" all over the place (without quotes of course), and thats just what I've seen so far. I looked at the source of the email in my email client (I'm using Netscape Mail) and they are there too but my email client does not show them. How does my email client know that they aren't suppose to be shown and what do they do in the first place?
View Replies !
Send Html Based Mail Like Newsletter
I try mail() function. we can send plain text mail using this function. but if i want to send Html based mail like newslatter then how it is possibal in PHP. Please describe in detial. I have little idea that i have to use mime multipart mail format for this, i don't know who to use this with mail function...
View Replies !
Getting HTML Source Based On User Cookies
I am attempting to get the HTML source of a web page on a different domain, but the source is based on the client's cookies they have stored for that site. I've tried using javascript with iframe's and XMLHttpRequests and HTMLHttpRequests, but it's restricted to inside my domain. With php you can get the HTML source of any web page using the file functions, but since its server-sided i don't think I would be able to open the page and get the HTML source based on the users cookies. Is there someway using PHP I don't know about, or mayb combinding javascript and PHP in some sort of AJAX engine?
View Replies !
Dynamically Creating Html Table Based On Array
I need to create a table based on parameters from a form on the previous page. The form sends up to 15 variables that are read out of the url into an array ($func). These variables refer to functions that a product may or may not have. This page should show which products have the functions chosen. Normally when I create such a table in DW, its always based off the DB directly with SQL, with a filter on the URL parameter. I can't work out how to do the same when there are multiple parameters in the URL, or alternatively, pulling the parameters from the array.
View Replies !
PHP Page That Displays Html Based On The Address Enterd
I would like to have a PHP page that displays html based on the address enterd. For example: index.php?example=a would show a page with <body>Example1234</body> whereas index.php?example=b would show a page with <body>Example5678</body>. I've done this before, but I can't remember the code I used.
View Replies !
Php Based Html Feedback Form Produces Blank Emails
I have a php script to handle feedback on a website that I've built for a colleague. The site was based on a template that uses a flash header and 'iframes'. Unfortunately, when the visitor submits the form data, the email that is sent off does not collect any information from the form. I'll admit I'm quite new to php so this is foxing me. Extracts from the Contact page on the site are provided below plus the php file. Code:
View Replies !
Header Function Into Html
i am trying to put an header function into html, but it doesn't work. Am I put the function wrong or what? Below is my script. <? header("Cache-Control: no-cache, must-revalidate");?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
View Replies !
How To Redirect To 404.html Using Header()
we need to redirect to a custom 404 page in PHP source code. For example, a page URL is htt p://www.site.com/info.php?id=123 When the DB query for id=123 returns nothing, I will redirect user to a custom 404 page, by using the following method: header("Location: /404.html"); However, according to Server Header Check, I just sent a 302 header and tell google that the content of www.site.com/info.php?id=123 is temporary moved to www.site.com/404.html (and please come back later). Code:
View Replies !
Can I Output Html And Still Use Header()?
I have a php script running on my localhost which on completion redirects to another script (itself actually - but with different parameters) using header(). It takes about 10 seconds for each script/page to load/run. Is there any way I can output some text without stopping header() from working?
View Replies !
Browser Based Ftp Login - HTML Page Where Users Type In A Username And Password
First let me say that I don't really know PHP at all. What I want to do is have an HTML page where users type in a username and password. After they click submit they are redirected to "ftp://username:password@domain.com" where they can download and upload files to their folder. Each username will have a folder in the directory that has the same name as the username. `So if "Mark" logs in, I want him to see the contents of the "Mark" folder where he can upload and download files. I don't want him to have access to anything else. As I know nothing, I did a lot of reading up and researching on how to do this (lots of great information on this site by the way) but the PHP code might still be way off. Here is the code I have so far: for the html login page: <html> <body> <form name="form" method="post" action="ftp.php"> Username: <input name="username" type="text" size="30"> Password: <input name="password" type="password" size="30"> <input type="Submit" size="8" value="Submit"></p> </form> </body> </html> the code for the ftp.php page is : <?php $ftp_server = 'domain.com' //domain being the future website domain $ftp_username =$_POST['username']; $ftp_password =$_POST['password']; $location = 'ftp://$ftp_username:$ftp_password@$ftp_server' header('Location: $location'); $ftp_connect_id = ftp_connect($ftp_server); $ftp_login = ftp_login($ftp_connect_id, $ftp_username, $ftp_password); if (! $ftp_connect_id || ! $ftp_login) { echo "Unable to connect to ".$ftp_server; exit; } else { echo "Connected to host "<p>"; } ftp_close($ftp_connect_id); ?> right now, when i check it, I log on the html page and go the the php page where all it says is "Connected to host." I don't see the "ftp://username:password@domain.com" that I want to see.
View Replies !
Url Extraction
can someone please tell me how I can get everything I need from a URL AFTER the third / including the third /. For example : (I host my own website atm to work offline http://xxx.xxx.xxx.xxx/home/comments.php?Item=xxx from the url with whatever the code is i would want: /home/comments.php?Item=xxx
View Replies !
How To Strip Header Section From An HTML Page?
I have an html page returned from a curl session in a variable. I want to strip off the header portion of the file and replace with a new header. It seemed to me that this is probably a well-known thing to want to do, but before I try to write the code myself, anyone have any code examples of how to do this?
View Replies !
Cannot Modify Header - Html Page With A Form
my code was working fine yesterday. I have a html page with a form and a php page that plugs the posted fields into a .rtf file. All of a sudden i get this error: Warning: Cannot modify header information - headers already sent by (output started at.
View Replies !
Avi Image Extraction
Does anyone know if it's possible to extract out the first image of an avi upon that avi being uploaded using file upload? What I'm trying to do is to automatically get a static image of the avi as the avi is being uploaded (so it can be used as a sample so the user can determine if they want to download the avi). I am somewhat familiar with the GD and ImageMagick, but I don't think this can be done with either of those.
View Replies !
Strings Extraction!?
im using sockets and php-win.exe to make a fully functional WEB SERVER!!! "PHP SUPPORTED" I have created everything so far, and I need help with the fnctinonality. so far I can acess the main page on both the local (1924) and remote (80) ports, but I need to be able to get the request: Code:
View Replies !
String Extraction
say that i have a template file like this text <template start> text text <replacable1> text <replaceble2> text text text text </template end> text what can i do to extract the bold text between the start and the end of the template tags(to replace the replacable tags with the variable value?
View Replies !
Simple XML Tag Extraction?
I'm fairly new at XML and im trying to find a simple way to extact the information from an XML file. My xml is fairly simplistic also, something like this: <name> <fname>Gordon</fname> <sname>Copestake</sname> </name> etc I would like my php to be able to do something like: <?php $xmlfile="test.xml"; xml_echo <fname>; xml_echo <lname>; ?> obviously this isn't real code, but this is the sort of functionality i want. Is there a simple way to do this?
View Replies !
Header Problem - Want To Display Html AND Download A File
I have a page that displays a form for user to select individual fields and to specify their own criteria which is used to query a database and then create an excel spreadsheet and download it to their PC. when the user clicks on the "create a custom query" link on the reports page the file customss.php displays the form that list the various fields and criteria to specify for the search. This part works fine. once the user clicks the button to submit the query the file customssdisplay.php generates the Excel file and then sends it to the client PC. The problem is that once the user cliks the button to submit the query, the form which displays the list of available criteria and fields is still displayed EVEN AFTER the spreadsheet has been downloaded to the PC. Here's what I would like to happen is: 1)user clicks button to create the custom query 2)the form is displayed for the user to check fields for inclusion and specify search criteria. 3)user chooses what they want and then clicks "submit query" 4)******* A page displays saying something like "Generating report...." 5)Excel File is sent to user's PC. OK now I've tried specifying a bit of html in the customssdisplay.php file that generates the spreadsheet but this gives me error messages saying that the header has already been sent. I suppose I could create a passthrough file which creates a form with all the fields hidden (taken from the search criteria page) but this seems cumbersome and inefficient.
View Replies !
Preg+data Extraction?
Basically what I am doing is creating some bb code for my blog script right now but I have run into a little problem with preg. I don't know how to extract data for manipulation. What I would like to do is have my script loop through the string until it finds a url wrapped around like below... Code: ["[BASE URL HERE]"] Extract the url into a variable and continue to loop through the code looking for Code: [[PATH]] then extract the path found between the double square brackets into another variable, then use a temp var. to append the contents of the ["[]"] and [[]] together to be placed in a hyper link... then continue on looping through until either another ["[base url]"] is found or the end of the string has been reached. Now with my limited understanding of regular expressions in php I believe the regex for the two codes above would be something like this: Code: bb style code: ["[BASE URL HERE]"] regex: /["[(*.?)]"]/is bb style code: [[path]] regex: /[[(*.?)]]/is How would I accomplish the above?
View Replies !
MySQL Data Extraction
Using the following code (with MySQL user and password removed , the data extracts correctly, but the carriage return () doesnt seem to be working, the data is just displayed across the screen. Code:
View Replies !
String Insertion And Extraction
is there a function to replace a section af a string with another regardless of the values and to do the reverse i.e. $srt1 = "ABCDEFGHIJKLM") $str2 = "XY // insert $str2 in to $str1 [3] and [4] $srt1 = "ABCXYFGHIJKLM") AND $str = $str1 positions [7] and [8] $str = "HI"; I want to do some incripion on text. OR will I have to create something?
View Replies !
Regex Table Extraction
I want to develop a regex which can extract all of the values between tags, i.e. >[^<]+<, grouped by each td tag within a table. I can come up with an expression that selects each td pair, or an expression which extracts values, but not both. Can a regex which does both be created, or should I break this down into 2 steps: 1) Extract td groups 2) Extract values from each group.
View Replies !
Html Page Link Prints Path 3 Times In Header
I have a website with html pages and a php page (a form). I just put in links on the html pages to the php page. When I click them I go to the php page and as bonus the path of the html page is printed at the top three times. (The text in the php page changes depending on which page I have hit the link from.) For example: Quote: http://mysite.com/sitefolder/previouspage.htmlhttp://mysite.com/sitefolder/previouspage.htmlhttp://mysite.com/sitefolder/previouspage.htmlhttp If I highlight and then delete this text in Navigator or Explore both browsers return me to the page written out three times at the top of the page. Here is the code that is giving me this result. Code:
View Replies !
Random Extraction Of Rows From Mysql Db
I want to pull out data from a mysql database in a random order. I want multiple rows pulled out and I want next and prev buttons. I have it all working (the next and prev part) but when I add the ORDER BY RAND ( ) part I get the error "Warning: Supplied argument is not a valid MySQL result resource" Can anyone help me? Can you get random results this way if you also want to use limit to put a certain number of results to a page? Here is my code:
View Replies !
Simple Question On String Extraction
I'm having to modify a PHP script even though I have little knowledge of PHP itself. The script extracts specific strings from an html file, and I need to it extract some further information. Specifically, each file represents an article written by an author. The author's name is typically preceded by a 'By' or a 'by', then it goes on till there's a carriage return. So for example, the file might contain something like this: The Need For Regeneration by <b>John Smith</b> We have seen the waste that has been produced.... (rest of article) or How To Make Lots and Lots of Money Writing PHP by The Supreme Coder The first thing you need to know about making money is... (rest of article) So I need code that will start searching the file from the beginning for the words 'by ' or 'By ', then grab everything that follows that until it gets to a new line and assign that to a variable. In the examples I have given above, it would grab '<b>John Smith</b>' and 'The Supreme Coder'. I've seen a function called preg_match which might do the job, but it uses regular expressions which I have little knowledge of. Would any person be so kind as to post what arguments I would need to call this function with?
View Replies !
Complicated Email Parse Or Text Extraction And Database Insertion
I am trying to strip some data out of numerous emails and place it in my database. I know that this seems as if it has been done before. But, this is a little different. First, the numerous emails all have a set of data that needs to be extracted and inserted into the database. Some of the data in the email is id, name, address, city, state, zip, company, etc. The catch is that the date is formated and presented differently in each email. Take into consideration the following email examples: - excert from email #1 ID:.............. 12345 Name:............ JOHN DOE Address:......... PO BOX 9999 City:............ Somecity State:........... CA Zip Code:........ 90210 ....
View Replies !
"Cannot Modify Header Information" With Large HTML FORM Options
I'm having some really odd behavior with a PHP script. I have it populating an HTML select form with a for loop. When I try the years 2006 to 1900. I get the following error: PHP Warning: Cannot modify header information - headers already sent by (output started at /Users/chrobb/Sites/city-directory/controlBar.php:54) in /Users/chrobb/Sites/city-directory/controlBar.php on line 88 I've done a fair amount of searching and it looks like this usually shows up when people have some extra whitespace after their closing PHP tags. Doesn't apply seem to apply here. When I crank the number down on the for loop to 94 iterations, the error goes away. Once I crank it up to 95, the error comes into play. So, it's tied to the output somehow. Looking at the raw HTML, there doesn't appear to be any significant difference between the version with 94 iterations versus the one with 95 iterations, except for the error and the failure of my script.
View Replies !
Cookie Based Script To Session Based
PMsys is a script that based on Cookies rather sessions(what are people thinking in 2003?) To intergrate this system to mine website, I got to change all the cookies to sessions. So, I think 1st replace all the: $_COOKIE into $_SESSION and then write a function that search and find a line that contains: setcookie('a', 'b', $whateverthetime); into session_start() $_SESSION['a'] = 'b' will that work? is there anymore things I have to think about? anyone can write a function to do that? I just can't get a hold on regular expressions.
View Replies !
Sending "header" Info After HTML?
I am looking to use "header("Location:index.php");" in my code. Basically this will be called when the user logs in to redirect them to the home page but as you expect I get the usual "headers already sent message" Just wondering how to get around this? Do I use the ob_start() method or something?
View Replies !
How Do I Use "foreach" Construct With Database Extraction
Below are excerpts from two PHP scripts that I am working on. What I am wanting to do is determine if the $UserName variable exists in the database tables "California" and "NewYork". If the $UserName variable is present on the first iteration the script will output "UserName is in this table!" and so forth for each iteration. PHP Code:
View Replies !
Header() Function - Warning: Cannot Modify Header Information
I have attempted using the code provided, but I consistantly get an error concerning the header() function found on the bottom on the script. What am I not understanding about header information? I always get this error: Warning: Cannot modify header information - headers already sent by (output started at C:apacheApache2htdocsPHPupdateupdate.php:9) in C:apacheApache2htdocsPHPupdateupdate.php on line 71 Is the tutorial not correct? Because I've seen similar tutorials that put the header() function in similar places too. Here is the code:....
View Replies !
Header Problem - Parse Error For The Header Line
Below is the extract of the problem part of the else loop. It gives me a parse error for the header line, the url is send from the previous page and is available as $_POST['url'] in general throughout the processing script. else { header( refresh: 2; url=$_POST['url'] ); echo 'Message has been sent.' }
View Replies !
Header Location - Cannot Modify Header Information Headers Already Sent By
I am trying to do a header location. but it is messing up. it is giving me the following error Cannot modify header information headers already sent by (output started at /home/content/i/n/n/****/html/***/connect2.php:19) I am using the following code if($_SERVER['HTTP_REFERER'] =="http://profileawareness.com/forums"){ }else{ header("location: http://profileawareness.com/denied.html"); }
View Replies !
Problem Setting A Received Header Using Header ()
I am reposting this as it wasn't very clear last time - and i still haven't made any progress with the code... i am sending a header(1) to page.html from sender.php using a socket connection. I would then like to read that page's response, and set that response as a header for sender.php (header2- parsed from the response of page.html in order to set any cookies etc.... that page.html might want to set) Whilst i have no trouble sending header(1) and retrieving the response, I don't seem to be able to set header(2) as a new header for sender.php or for any other page- I get a message from IE saying "the requested header has not been found on this site". Right now I am using the header () to set that header, as in the following code:
View Replies !
Header Error - Cannot Modify Header Information
I have read the sections refering to the following error message "Cannot modify header information - headers already sent by " and have tried to follow their suggestions. The first part of the program returns the required data and populates the form, but after changes are made to the data and an attempt to process the form is made the error message is produced I believe from the start of the php code. Code:
View Replies !
Header Error - Not Sure Where To Put The Header Line
I am getting the following error: Warning: Cannot modify header information - headers already sent by (output started at /home/forsa7/public_html/functions.php:155) in /home/forsa7/public_html/uploadform.php on line 228 I don't understand what is happening here, and am including part of the code, to see if you can tell me what I need to change. Code:
View Replies !
Header Error - Add A Header Command
I have some code that works fine until I add a header command. The code is: if ($_SERVER['QUERY_STRING'] == NULL) { print "No Query String"; } if ($_SERVER['QUERY_STRING'] == NULL) { header( "Location: http://mysite.com" ); exit; }
View Replies !
HTML Email Using PHP Problem (Receive Html Tags)
When I send the html email, the only thing I receive is the tags (the html codes basically). I want to be able to see the email like a html page, what is wrong with my code? Here is a copy paste of it. $HTML = "</html><body><img src='http://www.somewebsite.com/ someimage.jpg'></body></html>"; $headers = "From: $from "; $headers .= "MIME-Version: 1.0 "; $boundary = uniqid("HTMLDEMO"); // Now we attach the HTML version $headers .= "--$boundary ". "Content-Type: text/html; charset=ISO-8859-1 ". "Content-Transfer-Encoding: base64 "; $headers .= chunk_split(base64_encode($HTML)); mail($to,$subject,"",$headers); print "mail Sent<br>"; The email I receive has this as text: </html><body><img src='http://www.somewebsite.com/someimage.jpg'></ body></html>
View Replies !
|