Category ArchivePHP
Category ArchivePHP
PHP & Programming Daantje on 15 Feb 2010
Found bug in ezpdf (009) when using sessions and an older php 5.2.0 version. Loose the session and pdf file will parse correctly. Strange that this bug is not appearing with php 5.2.6
jQuery & PHP & Programming Daantje on 10 Jun 2009
I’m now busy with writing a filter, to grep data out of an large based HTML website, build back in the old days. Luckily they’ve used class names to point out the right table cells. I thought it would be a great job for jquery… But server-side… Could it be possible?
After some googling I found this very interesting blog post: “Bringing the Browser to the Server“. A real great way to use a javascript lib like jquery or prototype server side!
I use PHP to grep the HTML and transfer it to valid XHTML so I can use it in rhino.
./html2xml.php [path/to/file.html]
#!/usr/bin/php -q
<?php
$doc = new DOMDocument();
$doc->loadHTMLFile($argv[1]);
$html = $doc->saveXML();
$html = str_replace('<script','<noscript',$html);
$html = str_replace('</script','</noscript',$html);
echo $html;
?>
Than I use jquery to grep all data and do an ajax request to a PHP file to insert the data into a database.
After some testing, my scripts only work wit an older version of jquery. I use 1.2.6, the later ones all give errors…
I’ll try to post more info and code later ;) Check my tweets for info too!
PHP Daantje on 26 Oct 2005
I wrote this little PHP script for a friend of mine. He needed to redirect to a xhtml page when a user with a mobile device (internet capable PDA or phone) connected to his homepage. This script is very easy to implement… Just put it at the top of your first index.php file. When a user connects, this script will check the user agent (browser) and when a trigger is present, it will redirect. Hope it helps someone… Have fun.
$redirect = "/2005/xhtml/index.html";
$agents = array(
'Zaurus',
'PDA',
'PalmOS',
'Xda',
'LG',
'MOT-',
'SAMSUNG-SGH-',
'SIE-',
'SonyEricsson',
'SHARP',
'NEC-',
'Panasonic',
'Nokia',
'MDA'
);
foreach($agents as $i){
if(strstr($_SERVER['HTTP_USER_AGENT'],$i)){
header("Location: ".$redirect);
exit;
}
}
MacOS & PHP Daantje on 27 Feb 2005
1st try:
I’m building a project timer app in PHP with the php_gtk.so module. But I can’t compile it for my Mac… I have it running on my linux based machine, but not on my mac yet… I’ve found these pre-compiled libs, but it still doesn’t work…
I’m now checking the Fink stuff… I think I miss some GTK lib…
2nd try:
Found the gtk lib, but still no luck… If someone has an idea, please post!. I always get this error when I fire up a php-gtk script:
I have it working! This is what I did… I’ve downloaded the latest source from php.net. Unpaked it and compiled it with this configuration:
./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-apxs2 --with-ldap=/usr --with-kerberos=/usr --enable-cli --with-zlib-dir=/usr --enable-trans-sid --with-xml --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --with-iodbc=/usr --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc
Do a make and make install command to update the existing php binary.
Now download the latest php-gtk source and compile it.
./buildconf ./configure make make install
Now you should have this file: /usr/lib/php/extensions/no-debug-non-zts-20020429/php_gtk
rename the php_gtk to php_gtk.so
mv /usr/lib/php/extensions/no-debug-non-zts-20020429/php_gtk /usr/lib/php/extensions/no-debug-non-zts-20020429/php_gtk.so
Make sure that the file is executable;
chmod +x /usr/lib/php/extensions/no-debug-non-zts-20020429/php_gtk.so
Okay now your done… Don’t edit the php.ini to use the php_gtk.so at startup, or else you can’t use php in your Apache webserver! Use the php_gtk.so with this line in your source: dl(’php_gtk.so’);
To get it to work,
start up X11 (This is very important! php-gtk needs X11 or Xdarwin to run or else you get this error:
Fatal error: php-gtk: Could not open display in php-gtk-1.0.1/test/hello.php on line 4)
Xdarwin comes with Fink, a package management system for MacOS X based on the Debian apt tools.
Start your file in the terminal of X11 or Xdarwin and open a bottle of beer!
MacOS & PHP Daantje on 27 Feb 2005
Yes it works! Read my howto on how to make it work. Now I can build my project timer ;) I will make it GPL when I’m done…
Projects & MySQL & PHP Daantje on 26 Oct 2002
Finaly, becouse my brothers site ‘oorsmeer.com‘ needed a new guestbook, I’ve recoded my guestbook code. It’s downloadable and usable under GPL license. Check it out…
Projects & PHP Daantje on 26 Oct 2002
We’re building the website for be-HOSTING now, and I’m inplementing the WhoisDomainCheckup script. And found a bug. The .info domains are always registered. This is not true! This is because my HTTP/1.1 header is wrong, change in the include the ‘fsockopen()’ string HTTP/1.1 in HTTP/1.0 and the bug is gone… I’m checking out how to send in 1.1 the IPnumber of the server… New version is on it’s way now…
Projects & PHP Daantje on 20 Oct 2002
I’m going to make classes of all my scripts, for better implementation! I have something to do this weekend! ;-)
Purchase Cheap Oem Adobe Flash Professional Cs5 In German
Buy Microsoft Windows 7 Ultimate Sp1 Online Microsoft Office 2010 Visio Premium Online Purchase Adobe Dreamweaver Cs5 Online Oem Adobe Dreamweaver Cs5 In German Online Purchase Microsoft Windows Vista Ultimate Sp1 Online Purchase Discounted Microsoft Office 2008 For Mac Online Purchase Adobe Creative Suite 4 Design Premium Buy Cheap Adobe Photoshop Lightroom 3.2 In German Online Buy Cheap Adobe Photoshop Cs3 ExtendedBuy Cheap Oem Microsoft Office 2004 Pro For Mac
Buy Discounted Oem Adobe Creative Suite 5.5 Master Collection
Purchase Discounted Oem Microsoft Office 2003 Professional Edition Purchase Cheap Adobe Photoshop Cs3 Extended Online Cheap Oem Adobe Fireworks Cs4 For Mac Discounted Oem Adobe Acrobat 8 Pro For Mac Online Purchase Discounted Adobe Creative Suite 5.5 Master Collection Multilanguage Online Purchase Cheap Adobe Premiere Pro Cs5.5 Online