php

php http post button

Hi there, I'm using PHP to data scrape another website. However, on certain occasions I need to confirm a variable (due to have two very alike possibilities). The button I'm supposed to click to confirm my variable is: <input type="submit" class="buttonEmphasized confirm_nl" name="start" value="Bevestig" accesskey="s" /> However, ...

How can I define a variable before create the class?

Hi How can I define a variable before or while initializing the class? <?php class class{ public $var; public function __construct(){ echo $this -> var; } } $class = new class; $class -> var = "var"; ?> ...

Continuing a SHA1 hash in PHP

Is it possible to "continue" a hash in PHP? Say for example I start hashing a large chuck of data like this: $ctx = hash_init('sha1'); hash_update($ctx, $data_block); $hash = hash_final($ctx); That's all well and good but suppose the data is not fully available at that point and I want to "pause" the hashing mid-way and save where we'...

sort objects, some should always be first

I have a collection of country objects that look like this: class country { public $uid; public $name; } Now I should sort them. One country with id == 999 should always be first in the collection, the rest should be sorted by name. So, I thought usort should actually do the trick, but the sorting is not correct. I tried this:...

onclick disable submit button

hi, i wanna disable a submit button when onclick. im able to disable the button but i cant submit the post value to php. ...

How to convert a country string to its ISO 3166-1 code using Zend?

Does anybody know if it's possible to use Zend_Locale to get the ISO 3166-1 code for a country if you have the country name as a string? For example I have "Nederland" so I would like to get "NL". ...

Adding Disclaimer in PHP source code files

We have a PHP project and this is our first product delivery. We want to add a disclaimer to all *.php files in the project. Is there any free/OS tool that we can use to avoid donkey work :( ? We have around 100 source code files. ...

How can I get the error message for the mail() function?

I've been using the PHP mail() function. If the mail doesn't send for any reason, I'd like to echo the error message. How would I do that? Something like $this_mail = mail('[email protected]', 'My Subject', $message); if($this_mail) echo 'sent!'; else echo error_message; Thanks! ...

php mysql display by views

hey, thanks for loking. i have 3 tables books, book_category, book_click. books table book_id, url, title, img, short_desc, featured, enable book_category table book_id, category_id book_clicks table site_id, time, views i like to get data from books table by view SUMS but this only returns one result SELECT books.book_id, url, ...

While working on Twitter app, do we need to store user specific Access Token/Secret to our local databse

Hi, I am working on a Twitter app. By going through the oAuth documentation and available scripts I am able to redirect the user to my callback uri and am receiving the user access object. $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET); /* Get temporary credentials. */ $request_token = $connection->getRequestToken(OAUTH_C...

Saving file on disk

Hello, In Java, while using Glassfish Server, we could only save files relative to our web application root. Thus you cannot directly save file on eg c:\program files\abc.txt whereas with php this is working. Is it valid? One should not be able to refer any location on hard disk outside web application root (unless you are using Virtual...

parsing xml document using cURL

I am trying to parse an xml document I created in a php file and outputted using echo $xmlMysql->saveXML(); using cURL I send the information over, but when I try and parse it through using the following code. $xmlDoc = download_page($url); $dom = new DomDocument(); $dom->load($xmlDoc); echo $dom->saveXML(); I get this erro...

limit characters from <?php the_tags ?>

I have a layout that have to show the tags horizontally. I want to be able to limit the amount of characters outputted. Example - if I set the limit to 14 the following should happen. Original: Cats, Dogs, Rain New output: Cats, Dogs, Ra.. Please note that <?php the_tags ?> returns an array. It is everything returned I want limited to...

Peculiar Behaviour with PHP (5.3), static inheritance and references.

I'm writing a library in PHP 5.3, the bulk of which is a class with several static properties that is extended from by subclasses to allow zero-conf for child classes. Anyway, here's a sample to illustrate the peculiarity I have found: <?php class A { protected static $a; public static function out() { var_dump(static::$a); } ...

Using spl_autoload() not able to load class

I'm playing around with the SPL autoload functionality and seem to be missing something important as I am currently unable to get it to work. Here is the snippet I am currently using: // ROOT_DIRECTORY translates to /home/someuser/public_html/subdomains/test define('ROOT_DIRECTORY', realpath(dirname(__FILE__))); define('INCLUDE_DIRECTOR...

How do i save logs in php

Hello, How do i save logs in PHP? Is there any "magical" function available in php for doing so, or any library? Or should i have to fopen file everytime and dump in it? I want to save my logs in text file. Thanks in advance :) ...

different css class on the same echo?

Hello there! here is the problem...I have just this line of code: <p><div class="author"><?php echo $relevantEntry['author']." | ".date("D d M Y h:i:s A", strtotime($relevantEntry['date_time'])); ?></div></p> and I want to apply a different css css to author and date...but I still want them to be in the same line and be presented as t...

SEO questions before launching new web site...

Hi, I'm launching this big database (1.5+ million records) driven website and I want to know some SEO tips before.. Which links I need to tag as rel="nofollow", rel="me", etc? How to prevent search engines to follow links that are meant to users only? Like 'login', 'post message', 'search', etc. Do I need to prevent search engines from...

jQuery .load doesn't load swfobject content

Hello, I'm loading some content (NOT THE HTML headers or anything, just HTML formatted content from a PHP) via jquery .load() into a div. It works, perfectly for everything BUT some Flash-based amCharts (www.amcharts.com) dynamically loaded with amCharts PHP, using swfObject. The file, loaded seperately, works and loads the Flash charts...

Serving Large Protected Files in PHP/Apache

I need to serve up large files (> 2gb) from an Apache web server. The files are protected downloads, so I need some kind of way to authorize the user. The CMS I'm using uses cookies checked against a MySQL database to verify the user. On the server, I have no control over max_execution_time, and limited control over memory_limit. My tec...