Finding Links In A Page
I want to parse a html file in order to retrieve all its links and put them in a table. Can someone please help me w/ the better way to do so ?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Finding All Links (like Trans-sid)
Im trying to replicate the action of enable-trans-sid with a script. e. g throw a function a html page/string and it will replace all links - relative or absolute - with a variable at the end. either link.html?var=$var or link.html?inpage_var=something&var=$var depending on whether the link had a querystring on it already. any ideas? anything already done? dont really want to reinvent the wheel. Im guessing preg_replace_callback is going to be used.. something like $html = preg_replace_callback('/<(a|area|img|link|frame|iframe|input)(.*?)(src|href )(s?=s?)("|')?([^> '"]+)/is','rewrite_url', $html); function rewrite_url($html) { }
Finding Text Within A Page
Basically I want to search a page for words and if they are found I want the script to do one thing. If they're not found, I want it to do something else.
Finding What Page Wanted To Include
guys say if I include("anyfile.php") into a file. Is it possible for me to access the calling page from anyfile.php. Can I do something like this for instance:: if callingpage == "newauthor.php" then mysql(INSERT into author.....) else mysql(INSERT into content...)
Problem Finding Source For Php Page
We have a page on our site and I have identified what should be the php file on the server that generates it, but when I change the file, the changes are not reflected in my browser (after I refresh).
Finding Out How Long It Took To Render Page?
Does anyone know of a quick and dirty way to find out how long it took to render a page? I'm using PHP4 and MySQL3 and Apache. Is there perhaps some mod_php function, or what?
Search Page Result Links
I have a search function pulling data from a MySQL db which works nicely - other than the fact that I can't get the URL to link correctly when the linked document is located in the home directory. All other docs are located below the home directory by group/project/category. When I try to use an 'if' statement for one of the query parameters, I either lose the link, get a link that has the doc that is in the home directory with the full path (that doesn't really exist as folders), or get an undefined index error. Here is my current code - I have edited it several times over that past couple of hours, so I have reached the point of not being able to tell what is correct, and what isn't. I have used projCode, groupCode, projID, groupID parameters and still can't find the magic solution. I would really appreciate another set of eyes. ---snip--- mysql_select_db($database_website, $website); $query_search = "SELECT Distinct docURL, docTitle, docDesc, docs.projID, groupCode, projCode, catName FROM docs JOIN subcat on subcat.subcatID=docs.subcatID JOIN cat on cat.catID = subcat.catID JOIN groups on groups.groupID=proj.groupID JOIN proj on proj.projID=docs.projID WHERE proj.projID=docs.projID AND docURL LIKE '%$keyword%' OR docTitle LIKE '%$keyword%' OR docDesc LIKE '%$keyword%'"; $search = mysql_query($query_search, $website) or die(mysql_error()); $row_search = mysql_fetch_assoc($search); $totalRows_search = mysql_num_rows($search); $proj = $row_search['projCode']; ?> <?php if ($totalRows_search < 1) { echo "No internal documents matched your request."; } else {?> <p><table width=95%> <tr><td colspan="3"><font size="+1">Internal Documents:</font></td> </tr> <tr> <td><strongLink </strong></td> <td<strong>Description</strong></td> <td<strong>Project </strong></td> </tr> <?php do { ?> <tr> <td> <a href="<?php if ($row_search['docs.projID'] == 1) { echo $row_search['catName']."/".$row_search['docURL']; } else { echo $row_search['groupCode']."/".$row_search['projCode']."/".$row_search['catName']."/".$row_search['docURL']; ?>"><?php echo $row_search['docTitle'];......
Relative Links From Html Page
I am trying to pass variables from a html form to a php form. I am using IIS as a server on XP Pro and find that relative links are not working (see explanation below), but a fully qualified link (http://localhost/weblink.php) does work. If the relative link is used, the browser opens up the PHP page as code and does not execute the code. Is this a IIS problem, or a configuration problem, and where might the problem be?
How To Count Links To External Links?
I get results of the query diplayed on my find.php page with links to different web sites. I want to store count of clicks on each of those links that are displayed on my find.php page. How can I do that?
Active Persistent Links And Active Links Both 0
I just installed Apache/MySQL/PHP I'm trying to test if the connection to MySQL is there I know the database works on its own, I checked that when I run phpinfo() I get mysql listed, I'm just wondering if when it says "Active Persistent Links" and "Active Links" both 0 (zero) under "enabled" column, is that fine, meaning configured properly?
Finding How Many There Are In A Var
how can I find out how many newlines there are in a variable? It's not hard to find out if there is a newline in the var, but I wanna know how many!
Finding Id Value
i am using php and mysql for this. i only want to keep the last 5 entries in the database. so i will add an entry in, which will have an ID value, then i want to delete the id with the lowest value, which in turn will be 6 from the last entry added. so the code will look like this: $oldid = $newid - 6; $deletethis = mysql_query("delete from table where id = $oldid"); is there a simple way to find the value of $newid ?
Finding Out An IP
I've been wondering for some time now, how to get every visitor's IP address and log them. Any ideas?
Finding Referer In PHP
I'm trying to determine the location a user has come from when they access a script of mine (a custom web logging script). I've searched the manual for 'referer' but can't find any relevant references and looking at output from phpinfo doesn't shed any light on which, if any, variables might hold info about where the user has come from.
Finding The Sum In Mysql
What would be the easiet way to add the values of a certain field in every record that it occurs in. For example, If a person is placing multiple orders on a website and each order is to be shipped to a different location. Each seperate order is being stored in the mysql db and I need to add the shipping costs of all orders together when the user is ready to check out.
Finding The Last Occurance
I'm working on a update at my site. Every file on a part of the site means something. I want to accomplish some kind of a directory browseing and at each file displays the realtive info in it. Anyway... The following part of the code is made for finding the last occurance of '/' and after i did it, it looked kind of 'primitive' to me :). Is there any other optimised way of finding the last occurance of a substring in a string ?
Finding MySQL With 5.0.3
I have loaded PHP MySQL and Apache on windows in the past but recently had to reload my Win XP which is SP2 fully updated. Have reloaded Apache - fine - and MySQL and MySQLAdministrator - working fine Loaded PHP 5.0.3 and worked through configuring the ini to show a path to the ext file and so forth - copied some of the dll in the apache file. Copied many of the addtional modules in pecl into the php/ext directory and uncommented lots of them in the php ini (as suggested in a web tutorial - actually I don't NEED all of them yet) Installed PHPMyAdmin and configured that and then tried to connect but only get the error message that "cant find mysql" I tried this twice first with MySQLi and then MySQL set in the PHPMyAdmin configuration. Same result - some advice on a forum to a similar question suggested copying the dll files to the main php directory (just meant moving them up one in fact) and I did but that does not work either phpinfo shows lots of the modules but not MySQL or MySQLi I am rather puzzled - can anyone help this (long winded) problem?
Finding The Php.ini File
Is there another way I can find where the php.ini file is located besides using phpinfo(); The one that shows up in that file is not a valid directory--is not reading from the php.ini where I have it stored because the changes I'm making to the ini file are not reflected when I run code. I can't do anything with session or includes because the I can't get php to read from the ini, or it is reading from another ini file and I don't know how to access it.
DOM Child Finding
Is there any faster/easier way of finding a child node of a certain DOMNode object than doing something like function getChildByTagname($curnode, $name) { foreach($curnode->childNodes as $node) { if($node->nodeName==$name) { return $node; } } } ? it seems fairly slow and cumbersome. i was thinking xpath, but i can hardly imagine that to be a lot faster, with all the DOMXpath object creation and all, though I didn't benchmark.
Finding Directory
would like to know if there is a way to locate a specific directory on your site. I have a script which scans a directory, but it is not always running in the same directory, so the relative path to the scanned directory will be changed. Is there a way to find the location of the directory to be scanned, and build a relative url to it?
Finding H-tags
I am trying to build a script whic will convert html pages, to php, and formatting them to fit the php file's setup... i am trying to also improve navigation - which is where i am stuck. I need to find all information located between any number of <h2> </h2> tags, and place the contents into an array, which i can then print of, and link to that section i just need to find a method to find the information, and then put it into an array.
Finding Out IP Addresses
is it possible to get the persons IP address so that depending on what IP he has come from, I send him to a different page? any ideas?
Finding Pagination
First, let me say this is NOT a "How do I paginate my results?" question. I know how that works. Problem: I have items that are listed by date and medium. Both have paginated listings for searching for items. What I need to do is go back to either list to the page where the current item is listed. Say item #10 is listed on page 1 of dates, and page 5 of mediums [simplified for illustration]. I want the user to be able to come from dates - then move to the mediums listings, while finding the item just viewed on the resulting page. To determine the mediums listing I tried a function where I looped through a pagination function looking for the $id of the item in the result set with in_array(). It would only return the highest page number, if it returned anything. I have really trashed the function, and have to start from scratch. It seems my logic is wrong. Code:
Finding Out About Html_doc()
I'm trying to get some PHP4 code working on PHP5 - and am having an issue with a part of the code that uses html_doc() to turn html text scraped from a website into something that can be processed by DomXml functions like xpath_eval() I've found a nice looking wrapper at http://alexandre.alapetite.net/doc-...mxml-php4-php5/ which seems like it should do PHP4<->PHP5 work, except that it doesnt support html_doc(). I've tried replacing html_doc() with: domxml_open_mem($doc,DOMXML_LOAD_RECOVERING) but I can't get that to work even with the PHP4 - is that down to validation errors in the HTML? My problem is that I can't find any documentation to explain what html_doc() is meant to do and I'm new to the details of domxml coding (though I know what an XPath is...) In summary, two questions: - can I use domxml_open_mem() as a replacement for html_doc() in PHP4/domxml. If so, how? - where can I find documentation on html_doc()? I've googled, searched php.net and looked through group archives and can't find anything
Error Finding
My current web site appears correct. However, I know some browsers are smart enough to get around misplaced tags, and other syntax errors. Does anyone know of a good browser(s) that isn't so forgiving but still supports server-side html (shtml) and php scripting? Also, are there any tools out there that identify syntax errors within html, javascript, php, and or pearl code?
Finding The Mode?
Does anyone know how to write a program to find the mode of a series of numbers? I need to find the mean, median and mode. I was able to find the formula's for the mean and the median. But I have not been able to find a formula to find the mode. I know that the mode will be the numbers that are listed multiple times. I just can not figure out how to write this in the program to echo the mode.
Finding Out IP Address Behind NAT
I am writing a PHP app for a small business (family member owes me after this...) but they need to get their box back before I am finished. They have a DSL with dynamic ip and I need to be able to SSH in to their box, so I need to write a script that i have run as a cron job that will email me the current public IP of their DSL modem...
PHP Finding Text
i want to create a PHP Script that would go through a list inside a text file and ignore all of one kind of value and print all of another? e.g. lets say i had a text file that had in it: koum test test test test koum i would want it to go through that text file, ignore all of the test's and only print or echo the koum's.
Finding The Mode
Can't figure out how to find the mode of a file (string occurring most often). Has anyone else managed to do it?
Finding A Value Within A String
Say I have a string, for example: "Name: bob, Age: 22". I know that there is a name stored in there and that it is in that format. How can I trim that string down until it's left with just the name?
Finding Php.ini On My Website?
I'm having trouble finding the php.ini file on my website (It's running a Unix server). I know it's located at /usr/bin/php, but how can I access the /usr/bin/ folder? Do I need shell access? And can that be done through cPanel?
Finding The Date
I need help in finding the date of the 1st day for a specified Week. Lets suppose if I specify the week of the year as 22, I should get the date as 5-28-2007 which is Monday. Is there any function or can I get a script which gives the above requirement?
Finding Sub Strings
I think i might need to use preg_replace. However I have never used it before and can't workout how to find the following. This is my string.. Call Out Fee for 10:00 on 20/8/2007 What I need is for this string to be reduced to 10:00 and 20/8/2007. These values would preferably be in an array. Could someone give me a hand with this please.
Finding Out Localhost
is their any way to find out "localhost" of mysql to get the actual address? If not, is their any way to pull the content of a table off of localhost and connect to mysql on another server and insert the data into a table there?
Finding Out A Future Date
I've creating a script that displays an advert on my site for 90 days. I've got the current date in the following format: $todaysDate = date(mdy); I need to know how to find out the date in 90 days time, keeping it in the same format.
Finding Records Within The Last 48 Hours?
I can't seem to find anything on querying to find records dated within the last 48 hours. Not just two days/calendar dates, but 48 actual hours. I'm hoping to do something like: SELECT record FROM table WHERE postdate > (NOW - 48hrs) does that make sense?
Finding A Space In A String
I am trying to find a space in a string. If I have a sentence like: This is a sentence. I would like to be able to find the second space form the endand then return that part of the sentence, so if I ran it on that sentnece above it would return "a sentence.", but I won't know what the sentence is.
Finding The Location Of The Function
To find out from where the particular function was called, we can use debug_backtrace ( ) inside the function. Is there any way to find in which the function is. I mean if there are large number of files in the project and I want to find out where the function is. ................ code ............... // where is the location of the function() function() ................ code ...............
Finding Unique Records
I have a text file with so many records. I need to find the unique name from the record. Format of text file...
Finding @ In A String, And Other Items
Ok - I want to check a string for @ in it (Im checking to see if a string that should contain an email holds a @ ) How would I go about this? preg_match? ereg? strstr? Examples? Also - how would I find any non alpha numeric characters in a string so I can give the user an error message. I dont want any characters besides alpha-numeric in the strings.
Finding The Results Of A Query
I am working on a script that will query a database for a FNAME/LNAME combo. If it finds the combo, I need it to do one set of instructions. If it doesn't find it, I need it to do something else. What I can't figure out is what variable to check against. Here is what I have for the relevant part of the script: $connection = mysql_connect($hostname, $username, $password); mysql_select_db($databasename) or die ("Cannot connect to database" ..mysql_error()); $query="SELECT FNAME, LNAME FROM (table) WHERE FNAME=('$FName') AND NAME=('$LName')"; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); mysql_close($connection); I tried checking the value of $result to see if it changed depending on whether or not it found the selection. It does not. I just can't figure out what to use for: if (some expression){ perform this code } else{ do this }
Finding Nth Root Of X Quickly?
what is a quick way of finding the nth root of a large number? My program checks a bunch of numbers to find their square root, cube root, 4th root etc. but I think I could make it faster. I've tried using pow($number,(1/2)); but the numbers I'm using are way to big (hundreds of digits) so I tried the same thing with bcpow() but it would only return 1 when I tried to use (1/2) as the exponent. Why is that?
Finding Images In HTML
I am a bit stuck. I need to read the contents of a form submission - namely a block of HTML and single out all of the image sources eg: Code:
|