php

simple php script to retrieve google keyword search completion

I am trying to retrieve just the search completion shown in Google search result for any keyword. For example the search completion for http://www.google.com/#hl=en&q=google+keyword+search is 48,400,000 (Results 1 - 10 of about 48,400,000 for google keyword search) I tried to use CURL but fail to retrieve the search result page. ...

how reliable is the COM extension from PHP 5?

I am playing around with the PHP5 COM extension http://de3.php.net/manual/en/book.com.php by creating my own dll in C# and using types from it in PHP. Apart from the minor annoyance that my dll apparently has to be installed in the GAC my toy app did work. I am wondering if anyone used the COM extension in a realworld project. What ...

Problems installing Drupal with Xampp and Ubuntu

I am attempting a fresh install of Drupal 6.14 on a Ubuntu 9.10 machine using XAMPP for Linux. I use XAMPP fine with Wordpress and some different frameworks. I am having problems after I download and extract Drupal to my /htdocs/. The following pic shows the errors I get. ...

request uri showing include path

I am trying to get the URL from a function I wrote. But because the function is included into the file, its brining back the include path and not the url. Is there a work around? i should get /example.php but instead i get includes/url-logger.php this is done via $_SERVER['request_uri'] cheers ...

Can I use regex for this?

Hi. Is this possible with regex? I have a file, and if a '@' is found in the file, the text after the '@' with the '@' is to be replaced with the file with the same name as after the '@'. File1: "this text is found in file1" File2: "this file will contain text from file1: @file1". File2 after regex: "this file will contain text from fi...

How should I handle uploads centrally and sanely in my web app?

Hi, I am creating a web application, which is basically a very specialised CMS. It's written in PHP with Codeigniter (though the specifics are not important) and is structure according to the MVC pattern. Many entities in this webapp require the ability to have uploads, e.g pages, articles etc. I have an upload controller which works...

Need help with "pack" for perl and php

Hello! I've the task to convert a crypt function someone made in perl into php code. Everything works okay except this: Perl: $wert = Encode::encode( "utf8", $wert ); $len=length $wert; $pad = ($len % 16)?"0".chr(16 - ($len % 16)):"10"; $fuell = pack( "H*", $pad x (16 - $len % 16)); PHP: $wert = utf8_encode($wert); $len = mb_strlen...

Bounced email parsing

I'm currently having a mess about with catching, parsing and sorting bounced emails. I have the basics set up nicely and it does what I want, which is nice... problem being is that there seems to be no standard to the messages returned in the bounced email. For example, some servers return the error code as specified by RFC 1893 and I c...

Find Links and Remove them from HTML

Hi, How can I look for links in HTML and remove them? $html = '<p><a href="javascript:doThis('Test Title 1')">Test Title 1</a></p>'; $html .= '<p><a href="javascript:doThis('Test Title 2')">Test Title 2</a></p>'; $html .= '<p><a href="javascript:doThis('Test Title 3')">Test Title 3</a></p>'; $match = '<a href="javascript:doThis('Test ...

php gd: create new image based on combine/join 3 images, and then rotate the new image

Basically I have 3 png images. They have the same height and different width. I want to create a new image on the fly, then join the 3 images (not merging, I want to respect the content of each image) and put them on the new image. After that I wanto to rotate that new image. I want to do it with php GD. If someone can give me an ide...

Php HTML DOM parsing.

<table width="100%" cellspacing="0" cellpadding="0" border="0" id="Table4"> <tbody> <tr> <td valign="top" class="tx-strong-dgrey"> <a class="anc-noul" href="http://www.example.com/catalog/proddetail.asp?logon=&amp;amp;langid=EN&amp;amp;sku_id=0665000FS10129471&amp;amp;catid=25653"&gt; Apple 8GB 3rd Generatio...

Library for Parsing Whois Results

Is there a library or common heuristic for parsing whois results programatically? I'm working on a signup form for an ISP, and they'd like to be able to check for domain name availability during the signup process. It seems like there's a lot of variation in whois results from the different top level domains Not found: sdfasdfasdfsdf...

php find oldest file in a folder

Hey, I need a PHP script that will find the date of the oldest file in a folder. Right now, I am iterateing over every file and comparing it's Date Modified to the previous file and keeping the oldest date stored. Is there a less disk/memory intensive way to do this? There are about 300k files in the folder. If I open the wolder in Wi...

PHP function declaration: function example(&$Test) { } Explain &?

In this example, what does the & accomplish? ...

Instantiate a new class with the value of a string

Hi. This might be a very stupid question :P But I found this really interessting: class SomeClass{ var $var = "this is some text"; function echoVar($name){ echo $this->{$name}; } } $class = new SomeClass() $class->echoVar("var") // will echo "this is some text" Can I do somethign similar, can I take the value of a string and inst...

Cross-product web authentication systems

I'm about to start a human resources web app system. My idea is to have the manager system and the website work with the same database, but make three or more "products" running with the same data. All in PHP and JavaScript. My question is how can I get an authentication system like Zoho or Google, with one account for all services, and...

ImageMagick failing to convert to JPG

Hi: We recently installed the latest version of ImageMagick onto our Linux server. I seem to be having issues performing the most basic of tasks. I am running this command line: /usr/bin/convert /location/to/source/design.ai /location/to/save/output.jpg Unfortunatly is saves design.jpg as an illustrator file (if I rename the file to...

Assigning variables based on sting data

Hi Gang, I have a inefficiently constructed form that is obviously sending one type of data per SELECT element. For simplicity's sake, here's an example. The form posts data from 2 SELECT elements, but it actually needs to contain 3 pieces of data. To the user, the SELECTs do contain 3 pieces of data; one SELECT denotes quantity and th...

CraigsList Auto-posting

I have searched high and low and have not been able to find a definite answer to this question. Does anyone know how developers auto-post to CraigsList using PHP (or CodeIgniter)? ...

Mysql_fetch_assoc is losing fields after assigning it to a array variable.

I have a simple function that calls a select query and populates an array with the results: $result = mysql_query($query); for ($n=0; $n < mysql_num_rows($result); $n++) { $row = mysql_fetch_assoc($result); $output[$n] = $row; } return $output; My table has about 60+ fields and mysql_fetch_assoc returns all of them. However...