473,396 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

PHP Coding question

I am trying to check to external web pages for values on the sites. I
am totally new to php and i am using the strip tags to check if the
value is there and that works for the one site but on the other site i
need to check if a gif file is present. Can anyone help?

Oct 19 '06 #1
1 1183
You may be able to use a simple regular expression. For example:

$html = file_get_contents('http://www.yahoo.com') or
trigger_error('file_get_contents');

if (preg_match('/\bimage.gif\b/', $html)) {
// Found image.gif
}

For a stricter match you could use a pattern like:
#<\s*img\s+([^>]*\s+)?src=(["\'](([^>=]+)?[/\\\\])?)?image\.gif(["\'\s].*?)?>#si

You can do more with regular expressions, or you could parse the HTML
with the PEAR module XML_HTMLSax3:

http://pear.php.net/package/XML_HTMLSax3

ca***********@gmail.com wrote:
I am trying to check to external web pages for values on the sites. I
am totally new to php and i am using the strip tags to check if the
value is there and that works for the one site but on the other site i
need to check if a gif file is present. Can anyone help?
Oct 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eakin, W | last post by:
After recently coming back to php after working in asp for several years, I want to do things well, so I'm very concerned with learning good coding practices. Also I'm trying to seperate logic...
4
by: Larry | last post by:
Help Please http://www.angelfire.com/folk/ps197_brooklyn_ny I currently have a main page that has a list of about 50 names. I then have 50 pages that are linked to the main page The...
144
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this...
7
by: Ralph Lund | last post by:
Hi. I am starting a new project with C#. I am searching for "good" coding conventions. I know that there are some coding conventions from microsoft, (but they are very extensive and not clear)....
1
by: R Reyes | last post by:
Hello All, I'm always looking for ways to improve my code. Most of the time (whenever I'm working on a project) I write a bunch of functions. Then after the project is finished, I put all the...
17
by: M.Siler | last post by:
I'm trying to get my head around a conversation I had with a developer the other day. We were talking about Codesmith vs. Hand coding. He's position is Codesmith is for junior to mid level...
7
by: Robert Seacord | last post by:
The CERT/CC has just deployed a new web site dedicated to developing secure coding standards for the C programming language, C++, and eventually other programming language. We have already...
3
by: bh | last post by:
If I want to loop through the values in a listbox, and get either all items in the box, or only selected items, based on a boolean variable passed into a subroutine, which method would be more...
1
by: Jennifer Jazz | last post by:
My question is regarding the mapping of Class diagram to the C++ coding. There are 3 realtions in Class diagram 1) Assosication 2) Composition 3) Aggregation (Weak Composition). ...
9
by: mekalai82 | last post by:
i have information.php file that file contain following coding <?php echo phpinfo(); ?> while i calling the URL ("http://localhost/information.php"). i am getting the coding <?php echo...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.