php

how to debug curl call to amazon s3 when it get stuck

I'm using the PHP S3 class and this backup script to backup ~500Mb file from Linux server to S3. The call to s3 gets stuck (never returns) and top shows httpd process which consumes 100% CPU and 1% memory. smaller files do get copied correctly. my question is how can I debug this (its basically a CURL call done by the S3 class) when not...

Zend PDF word wrapping

Does Zend_Pdf already support automatic wrapping of text? For example I want to create a textblock and fill it with text. This is a very important feature and unless Zend Pdf does not have it I am not able to switch from FPDF. Also I think a Framework that says it has PDF support should be able to offer their developers this kind of fe...

Creating an instance of a php key-value pair without an array

I'm writing a recursive function to construct a multidimensional array. Basically, the problem is as follows: function build($term){ $children = array(); foreach ( $term->children() as $child ) { $children[] = build($child); } if(!count($children)){ return $term->text(); } else { return $...

htaccess redirect when entering path in address bar

Hi all, I want to move some files to another directory on my web server, but these files are images, that my clients link to. I have not got the time to go and change over 100 image urls, so is there a way i can get .htaccess file to do a mod_rewrite to point then image url to where it should be? Thanks Fero ...

How does this PHP nonce library work?

From http://fullthrottledevelopment.com/php-nonce-library#download, there is a PHP nonce library, but there are a few things that I don't know understand. The first one is that it reminds us to set a value for the FT_NONCE_UNIQUE_KEY but it never uses it in any of its functions. The second thing is, when I call the ft_nonce_create_query...

re: UTF-8, PHP and XML Mysql

This is relating to http://stackoverflow.com/questions/1791082/utf-8-php-and-xml-mysql, which I am still trying to get my head around. I Have a couple of separate questions that will hopefully help me understand how to resolve the issues I am having. I am trying to read values from a database and output into a file in UTF-8 format. But...

List dates in months from database

Hey, I need som help to list my added dates from database, and split it into their added month. I have no clue on how to do it... Soe can someone please show me examples, or maybe some tutorials how to do? Thx ...

Is it possible to send a value of a variable from a js file to a php file

Hi, I have script and I'd like to know if it's possible the send the value of a variable to $_session, <script> $(function() { var delivery = 0; $('#jcart-paypal-checkout').click(function() { delivery = $('form#delivery2 input[type=radio]:checked').val(); if(!delivery) { alert('Please choose a delivery option...

php code will not write to text file

Is there a reason why my code does not want to write to my text file:guestbook.txt? <?php //Create a variable called $file that holds the guestbook.txt $file= "guestbook.txt"; //Create other variables $name= $_REQUEST['name']; $message= $_REQUEST['message']; //Check to make sure that all fields are populated if(empty($name) || empty($...

what is faster many ifs or else if

im iterating through the array and sorting it by values into days of the week. in order to do it i'm using quite many if statements. does it make any difference for the processing speed if i use many ifs versus elseif statements? ...

How to disable a form element in symfony?

I am using a Select element, in form 'country' =>new sfWidgetFormChoice(array('choices' => CountryPeer::getAllCountry())), 'city' =>new sfWidgetFormChoice(array('choices' => CityPeer::getAllCity())), i want that city element to be disabled, at the first time when the page loads. and on selection of country the city element will be en...

How to add mysites mail to whitelist?

hello friends, Currently I am developing a website.In this I have the option to send invittion.When I send the Invitation it going to spam folder.How can I send my site's mails to Inbox.Whether I nedd the trafic to add into whitelist?Or is there anyother way to make to directly send the email to Inbox.My site is developed in PHP......T...

Failsafe looping trough array of urls

How can I loop trought an array of external websites and not fail catastrophically if one of the websites doesn't respond? Consider the following psuedo code: $urls = array(list of urls); foreach ($urls as $url) { try { $page = get_page($url); $title = $page['title']; catch(Exception $e) { continue; } } What i wa...

How can I do a "does not contain" operation in regex?

This is my string: <br/><span style=\'background:yellow\'>Some data</span>,<span style=\'background:yellow\'>More data</span><br/>(more data)<br/>'; I want to produce this output: Some data,More data Right now, I do this in PHP to filter out the data: $rePlaats = "#<br/>([^<]*)<br/>[^<]*<br/>';#"; $aPlaats = array(); preg_match...

Generating Postscript using PHP: browser offers to save file

$ps = ps_new(); ps_open_file($ps,$filename); ps_begin_page($ps,$size,$size); ps_set_parameter($ps, 'SearchPath' , '/usr/share/texmf-texlive/fonts/afm/bluesky/cm'); $psfont = ps_findfont($ps, "cmr10", "", 0); ps_setfont($ps, $psfont, 12.0); ps_circle($ps,$size/2,$size/2,$size/10); ps_circle($ps,$size/4,$size/2,1); ps_circle($ps,$size/...

Calculating difference between username and email in javascript

Hi, for security reasons i want the users on my website not to be able to register a username that resembles their email adress. Someone with email adress [email protected] cant register as user or us.er, etc For example i want this not to be possible: tester -> [email protected] (wrong) tes.ter -> [email protected] (wrong) etc. But...

Magento - Removing the black background from automatic thumbnails?

Hi All On a Magento site, I’m just uploading one picture per product, and using that as the base, small and thumbnail images. However, my pictures aren’t square, so I’m getting a black background added to the thumbnail that’s created. Any ideas how to change that to a white background? I’ve searched for this but can’t find a decent a...

Crontab in Plesk

Hi, I'm trying to run a test script using crontab within Plesk. The php file simply emails me a message mail('[email protected]','Cron Test','Test'); My path to php is /user/bin/php I have entered * in every field, to run the script every minute with the following command: /usr/bin/php -q /usr/httpdocs/crontest.php However, the sc...

PHP - dom appendChild() - adding strings around selected html tags using PHP DOM

Hiya, I'm trying to run through some html and insert some custom tags around every instance of an "A" tag. I've got so far, but the last step of actually appending my pseudotags to the link tags is eluding me, can anyone offer some guidance? It all works great up until the last line of code - which is where I'm stuck. How do I place t...

PHP $_FILES file loop upload

I want to insert files into mysql from php function. The files that need to be uploaded are already present on the server, so I don't want to use the upload form. I want to loop through the directory and get the files info into $_FILES. Please let me know how I will get the $file into $_FILES and then call upload. $dir_handle = @opend...