Extracting Img Tag Info From HTML Source
I'm having a bit of a brain meltdown trying to figure this out. If anyone has a suggestion I could try, that would be excellent.
I'm trying to extract specific pieces of data from an html source file. In particular image tag information. If my file contains lines similar to:
<a href="images/picture.jpg" target="_blank"><img src="thumbnails/picture.jpg"></a>
I'd like to be able to extract the a href URL and the img src as two seperate variables and ignore any other HTML source and tags inside of the file. For all intents and purposes ending up with an array of the following:
$link[0]="images/picture.jpg";
$thumbnail[0]="thumbnails/picture.jpg";
View Complete Forum Thread with Replies
Related Forum Messages:
Extracting Info From HTML
Im needing some help with writing a PHP script. Basically all i want to do is write script that can extract data from a table in html format into a MySQL database on my server.
View Replies !
Filling My SQL Database With Info From HTML Source Code?
I am desperatly browsing around trying to find some way to add data to mySQL from raw HTML sourcecode. I basicly have HTML pages showing lots of info on work, and I want to take that info - add it to mySQL so I can sort, select and browse the information in a better way. Hope someone knows what I mean.. (many online textbased games have this on various fan pages for calculating purposes, ie. Earth2025 and Utopia)
View Replies !
Extracting Info From An Array
I have an array named Task and inside the array is another Array it looks like this [task] => Array ( [0] => prr [1] => tyh [2] => rfd [3] => sds [4] => yui [5] => rtr [6] => wer ) I need to find out how to extract the initials prr, tyh, rfd,sds,yui,rtr,and wer is there any way possible to do that so i can send each set to my database.
View Replies !
Extracting Info From Array Problem
I am having problems trying to solve an issue with something I would like to do with a site I am creating. I would like to store a bunch of words into an array. Then, I would like to be able to extract all of the words that, say, are repeated at least two times inside of the array. For example, $test_array = array("butter", "bread", "milk", "butter", "bread", "yoghurt", "butter", "eggs", "eggs"); I would like to be able to extract the words that are repeated at least twice, as well as extract the info about how many times they had appeared. So I would have something like butter - 3 times bread - 2 times egss - 2 time I am trying to extract this information, and thought about using a 'foreach' statement, followed by a 'for' statement that would go through the array and try and match the current array value (as retrieved from the 'foreach' statement) with the rest of the values of the array. If there was a match i would increase a counter variable by one. However, I am having lots of troubles with this, and because my knowledge of php is very basic, I am not sure of what to do, or if there is an easier way for me to achieve my aims.
View Replies !
Extracting Info From Files In A Flat File Database
I am in dire need of a script that can read the variable files from within a file (ie: client_01.inc). I already know about the include() and require() commands, but I want a table with a script that points to a directory of files. I have client files each with variables in each file and the table needs to extract the info from each file in that directory to display in the table. Code:
View Replies !
Extracting Specified HTML Tags With Regex
I have a regex problem, spent about 7 hours on this now, but I don't find the answer in the manual and googling, though I think this must have been discussed before. I try to simply extract the title and meta tags of a valid HTML page as an array: function extract_html($filename) { $ret = array(); // put file into string $contents = file_get_contents($filename); // title $p = preg_match_all('<(title|TITLE)>(.+)</(title|TITLE)>', $contents, $matches); if ($p > 0) { $ret[] = $matches[0][0]; } // metatags $p = preg_match_all("<(meta|META)(.+)>", $contents, $matches); if ($p > 0) { for ($i=0; $i<$p; $i++) { $ret[] = $matches[0][$i]; } } return $ret; } What happens is: - The title part gets no match - The meta matches are correct, but miss the opening < The examples I have seen in the manual all seem to have no problem with < and > in the patterns. I don't know where to look and also don't understand all parts of the regex section.
View Replies !
Extracting Parts Of An Html File
Given a regular formed html document, what would be the easiest way to grab 3 parts of the file? 1- everything from beginning of file up to and including the <body> tag 2- everything between the <body> and </body> tags 3- everything from and including the </body> tag to the end of file Storing the contents of the file into an array I think would be best but I can read the 2nd set into an array if I could figure out how to isolate it.
View Replies !
HTML Source
U want to catch the HTML source of the web page but I can't get this by file_get_contents().Us there any function to do that, or any method for doing that.
View Replies !
Get Html Source
I am trying to generate PDF file via a Dynamic URL. The problem is that i am trying to get the HTML source from this dynamic URL and paste the source of the file in the source below $HTMLSOURCE. PHP Code: $html = $HTMLSOURCE; $dompdf = new DOMPDF(); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream("sample.pdf");
View Replies !
PHP, Get Html Source.
I'm working on a project that needs to watch another website for activity. I can go thru a logon, query and signon at regular intervals. But it occurs to me that you can just see if something new has happened by viewing the site. So I was wondering if there is some PHP command to capture HTML source from an external website and then I'll search the html source for a number of images (or any related events, updates etc). So from a PHP script I'd like to point it at an unrelated website and scrape the HTML source for a particular pages.
View Replies !
Getting HTML Source
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 !
HTML Source To SQL By PHP
I got a static HTML page with some data I wanna insert it into mySQL. I ended up writing my own thing. where I search the source and put it to sql in php. but it does not work 100%, it sometimes add weird blank spaces and such. so I wonder if theres any existing tool / script / php source to do this that you guys might know of.
View Replies !
Delete From HTML Source <br />
I have many articles that have this <br /> in my HTML source: takes no obligation to revise the forward-looking statements contained therin ein to reflect events or circumstances after the date hereof as a result of <br /> It is ok to add: $query = 'update wp_posts set post_content=REPLACE(post_content,"<br /> ","")' But it doesnt delete, why?
View Replies !
Open The Source Of An Html Across The Net
I got my other question wrong. I wrote a script that opens a file and filters out email addresses and urls etc. is there a way to enter a url so that my script will open the source of the webpage and NOT the web page itself?
View Replies !
Html Source Into An Array
Im trying to get the html source from a certain page into an array, yet the file() function will not find the file. What can I do to accomplish this goal?
View Replies !
Html Source Output
When I use a php included file, my html source becomes messed up. Basically, the source does not stay indented like I want it. Is there a trick to getting the php includes to indent properly, thus resulting in a nice clean source output?
View Replies !
Get Text From HTML Source
I receive a site content with cURL. In the source is HTML input field and i need to get it's value. PHP Code: <input type=hidden name=NUM value="123456"> How to get 123456 ?
View Replies !
Entire HTML Source
I got this JavaScript function, which need all the text I wants as input to be on one line The []'s need to be on the same line for it to work. The input is a PHP variable, which is a file_get_contents from another site. So PHP makes my $thing multiple lines. How can I make it just one line, so that the []'s are on the same line?
View Replies !
Echo A Line In Html Source...
Say i am writing a few lines of code in php script as so... <?php echo '<table>' echo '<tr>' echo '<td> blah blah </td>' echo '</tr>' echo '</table>' ?> On my html source the code looks like this... <table><tr><td>blah blah</td></tr></table> Is there anyway I can get each html tag on a seperate line in the html source so it is nice and neat (easy readable)?
View Replies !
Open Source Ajax/php Html Editors?
Are there any open source ajax/php html editors? I want to incorporate as simple (very simple) ajax based html editor into a webapp I'm making. I spent an hour or so downloading code and saw nothing that actually worked. Don't need tables, just need to drag text around, set fonts and colors, upload images, have a simple form for making links. Does such a thing exist? I'm giving away what I'm making, so I don't want to pay for the parts.
View Replies !
Protecting Source Code On Mixed Html
How can I protect or block others from viewing my source code. I have a mixed form php and html, and someone has been trying to duplicate it. Each time they hit submit i get a text message on my phone, except all data is blank since they cannot connect to my database where all vars are stored.
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 !
Email Contatins Html Source Code Instead Of Displaying It In Web Format.
I created a couple forms for my site, I then purchased the proper program to make my forms work. When I submit the form, I recieve the email, only problem is that the email contatins html source code instead of displaying it in web format. Also the attachments are not being sent correctly, all the attachments appear as thousands of text characters within the body of the email. Almost like they are not being decoded. I checked and rechecked the form and my php program but they look fine, Am I missing something? I am not getting a lot of feedback from the person I bought the program from as of yet.
View Replies !
Passing Info From Html To Php
I'm trying to pass info from a "Drop list" in an .html form into a .php which will then query a database. It doesn't work and I wondered if I'm missing something easy? If I junk the dropdown list and just put a "textfield" there is no problem but I want to have the fixed choices list. Here is the code:
View Replies !
Pass Info From To HTML
I'm wanting to pass a value from PHP into a hidden input in HTML. I don't want it to travel in the URL if possible. for example to help paint the picture. From PHP I want to pass this: value="true" To HTML <input type="hidden" value="false">
View Replies !
Retrieveing Info Passed From Html
i have a flash banner on a page that when clicked sends the browser to another page. This banner is linked to a php file that counts the amount of clicks on the banner. In the html page for the flash banner I have: Code: <embed src="swfs/banner1.swf?clicktag=forms/tracking/bannertrace.php&clickheader=http://www.somewebsite.com" width="570" height="80" align="middle"> in my php file I have: PHP Code: <?php $traceFile = "banner/clicktrace.txt"; $clickURL = $_GET(clickheader); $fh = fopen($traceFile, 'r'); $theData = fread($fh, filesize($traceFile)); fclose($fh);$fw = fopen($traceFile, 'w'); $theData = $theData+1; fwrite($fw, $theData); However the clickheader variable that contains the URL does not get passed to the php file.
View Replies !
HTML Presentation Page For Uploaded Info?
I've seen a lot of posts about uploading files, but not much about what happens afterwards. Can someone point me to a tutorial, post or book which will help me solve this problem: I'd like to have a form where users can upload a photo, add a short bio, put in some contact info, and have all of this information stored in a database (natch). Then I'd like for this form to take this user's data and put it into an html presentation template. Ideally, members would sign in and be able to modify their own profiles as well as view other profiles.
View Replies !
How HTML Looks Like In "view Source"
Before when using only HTML to write static pages, I would properly indent and stuff so the source code and the HTML structure would be easily readable by humans. Now with PHP, the outputted HTML looks like a mess. I'm wondering if I should also keep that in mind and try to make the HTML outputted by PHP more readable. But just thinking about how I'd go about doing so seems like a lot of work. So is it practical or maybe there's an easy way to do so?
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 !
Putting Info Into A DB / Passing Info Between Pages
I have run into an issue...I have posted previously, but my scenario has changed. Here is the situation... If a user clicks on a link ('abc123' for example) I want to insert into my database some predefined information about 'abc123' - I have assigned a value that is echoed in future pages for 'abc123'. So, what I need is some mechanism to, when a user clicks 'abc123', have a pre-defined username and password be entered into the database. I need this so future pages can utilize the session values.
View Replies !
No Mysql Info Through Info();
I am trying to install mantis, and I get errors when I try to run the install script saying that mysql is not configured to run on php. I call the phpinfo() function and I see nothing relating to mysql. I open the php.ini file, and, to be honest, it looks alright. the extension_dir points to /usr/lib/php4 which includes the mysql.so extension. Furthermore, I located the mysql.sock file and pointed the default socket to it, but nothing. what exactly am I missing? Code:
View Replies !
Extracting URL
I am try to write a script using PHP and Ajax that is able to extract information from the URL. Says, web page 'A' will call this url using Ajax with information attached at the end of it So, I am just wondering how to extract the information from fname onwards. How will be the coding looks like in check.php?
View Replies !
Extracting The End Of A URL
I am trying too make a script that can check URL's, which I managed too do with no problem at all. I was wondering was there a way my users can enter multiple urls into a textbox and have the script extract the end of each URL. For example, the user submits: http://mydomain.com/files/13039621/2k5pro.part28.rar.html I want the script too delete the first part so it is left with: /13039621/2k5pro.part28.rar.html and place it in an array. It would also need to be able to take a bunch of links at one time, such as: http://mydomain.com/files/35539621/2k5pro.part28.rar.html http://mydomain.com/files/13242343/2k5pro.part29.rar.html http://mydomain.com/files/13423621/2k5pro.part30.rar.html http://mydomain.com/files/13044421/2k5pro.part31.rar.html http://mydomain.com/files/13252331/2k5pro.part32.rar.html http://mydomain.com/files/12449621/2k5pro.part33.rar.html
View Replies !
Extracting Data From XML ?
The following is the sample XML file from which I want to extract the data of which availabity ="Available" using php. The XML file will be generated dynamically from the URL http://www.upc.nl/zipcode.php?zipcode=3565BG <UPC-Results> <DateTime>05-12-2005 02:08:26</DateTime> <Errors/> <Products> <Product name="CaTV" availability="NotAvailable"/> <Product name="Chello Starter" availability="NotAvailable"/> <Product name="Chello Easy" availability="NotAvailable"/> <Product name="Chello Light" availability="NotAvailable"/> <Product name="Digitale telefonie FreeTime" availability="NotAvailable"/> <Product name="Chello Classic on DSL" availability="Available"/> <Product name="Chello Plus on DSL" availability="Available"/> <Product name="Chello Extreme on DSL" availability="Available"/> <Product name="Digitale telefonie Basis on DSL" availability="Available"/> <Product name="Digitale telefonie FreeTime on DSL" availability="Available"/> </Products> </UPC-Results> from the above XML, I need to get data of Product name which has the status of "Available"
View Replies !
Extracting Words
I'd like to extract the first 5 words from a blurb of text. I can't find an easy way to do that. Example. If I were to do that for this message I'd extract "I'd like to extract the"
View Replies !
Extracting XML & RDF Data Using PHP
I have an XML file that contains metadata in the form of RDF. The file is something like this: <?xml version="1.0" encoding="utf-8" ?> <xmpData> <WavXmpInfo path="C:.....................................") <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/ DynamicMedia/" xmlns:xap="http://ns.adobe.com/xap/1.0/" xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/" xmlns:xapRights="http://ns.adobe.com/xap/1.0/rights/" xmlns:dc="http:// purl.org/dc/elements/1.1/" xmpDM:audioSampleRate="16000" xmpDM:audioSampleType="8-bit" xmpDM:audioChannelType="1" .......... .......... .......... <dc:rights> <rdf:Alt> <rdf:li xml:lang="x-default">HHHHHHHHHHHHHH</rdf:li> </rdf:Alt> </dc:rights> </rdf:Description> </rdf:RDF> </WavXmpInfo> </xmpData> I want to extract data such as audioSampleRate, audiosampleType etc, so that i can insert them into a database. I'm having problems accessing this data. I'm using DOMXML. Can this type of data be extracted using DOMXML? If not how would one go about accessing it?
View Replies !
Help With Extracting Please Folks.!
I have this: a variable like: <a href="http://www.some_html.com/text.html" >some text</a><br> I heed to extract the "http://www.some_html.com/text.html " and put it in var "link" And extract "some text" and put it var "text",. So basically extract all between <a href=" and " > plus extract all between " > and </a><br>.
View Replies !
Extracting Text From Pdf
I have to index the text of a pdf document. Does any of you know of a PHP script/extension or a binary that is able to extract the text ? The pdf extension mentioned in the php.net docs seem to indicate that it's for _creation_ of documents only, is that so? Same with all the PHP classes i have found.
View Replies !
|