PHP: February 2007 Archives

2007 Feb 20

Here's a function from the php manual that returns everything inside two tags or between two string phrases. As we all know, substr requires the integer position of the string to return, so it would be hard if we are only given with start string and end string but not its integer position.


function substring_between($haystack,$start,$end) {
if (strpos($haystack,$start) === false || strpos($haystack,$end) === false) {
return false;
} else {
$start_position = strpos($haystack,$start)+strlen($start);
$end_position = strpos($haystack,$end);
return substr($haystack,$start_position,$end_position-$start_position);
}
}
$content = '<title>Tildemark blogs</title>';
$title = substring_between($content,'<title>','</title>');

the code above returns the title of an html page.

2007 Feb 8

To enable curl library with XAMPP we need to modify the php.ini files in our xampp folder.

1) Locate the following files:
C:\Program Files\xampp\apache\bin\php.ini
C:\Program Files\xampp\php\php.ini
C:\Program Files\xampp\php\php4\php.ini

2) Uncomment the following line on your php.ini file by removing the semicolon.

;extension=php_curl.dll

3) Restart your apache server.

4) Check your phpinfo if curl was properly enabled.





-----
Demand by businesses for 650-393 certified people is fueling the drive for IT certifications. Microsoft 70-284 certification along with 70-528 can be helpful in boosting your career to the next level. Today, PMI-001 and other IT certifications especially CISCO 350-029 certification are becoming as marketable as academic degrees. CISCO 640-801 certification is opening doors for professionals to the most rewarding posts in networking field.

About this Archive

This page is a archive of entries in the PHP category from February 2007.

PHP: October 2006 is the previous archive.

Find recent content on the main index or look in the archives to find all content.

Recent Activity

Today

  • tildemark tweeted, "@jjdoblados SmartBro wont work with linux because the installer is an exe file. plus SMARTBRO sucks my dialup connection is even faster."
  • tildemark tweeted, "i think i accidentally drank 2 dosage of my medication. now, im feeling dizzy. is there a way i cound unswallow it?"

Monday

  • tildemark tweeted, "I'm feeling tired. i hope the clock will run a bit faster this time."
  • tildemark tweeted, "got sick for about 3 days. ended up finishing nwn2."

Thursday

  • tildemark tweeted, "im planning to move again, but i dont know where."

Sunday

  • tildemark tweeted, "I drank 3 sachets of instant coffee, ang now i cant sleep even if my eyes are sleepy? I can hear voices.wtf"

Friday

  • tildemark tweeted, "im so sleepy. Zzzzzzzz"

Sunday

  • tildemark tweeted, "some of my scipts are not working with godaddy. but works fine on the others. not mention their poorly coded admin page"

Thursday

  • tildemark tweeted, "so many pending tasks i need to finish. need more coffee !!!"
  • tildemark tweeted, "@gmtristan i dont think that is true."