php

Unit testing facebook applications

What are good practices of unit testing facebook Canvas applications ? Lets say you have MVC application with controllers utilizing local Facebook library which provides access to Graph API, FB session. After all your application depends on facebook authentication mechanism (OAuth and Facebook Connect) thus user is required to authenti...

Facebook PHP share from my website

Dudes When you share something on Facebook (e.g. from Twitterfeed), it puts the icon and link for Twitterfeed website under the shared thing in this format: icon goes here 2 hours ago via twitterfeed · Comment · Like How can I make a page in my website send its icon and linked name? Thanks ...

Does any of you know how to mask a URL in php ? or related to Javascriptor Ajax ?

Does any of you know how to mask a URL in php?? Like the one you see in free URL redirectional services (http://www.shorturl.com) I mean I have a url like http://www.my-server.com/ which will redirect me to http://www.some-other-server.com/abc.php But I want the URL in the address bar of my browser to show only this URL http://www.my...

How can I search the string X times in the DB? (MYSQL + PHP)

Hey, first I use SQL + PHP the type of DB is MYSQL. I have a column with the many strings, but I want to search the string 08/08/10 if it exists 5 times for example in the column, how do I do it? ** If I will do: SELECT * FROM x WHERE y LIKE '%08/08/10%' Maybe it exists, but I don't know if 5 times.. Thank you very much! ...

Check serverlist offline / online PHP

Hello, i try to make a script to check if my server are online or offline: <? $server = "12.34.56.78"; $check = @fsockopen($server, 22); if ($check) { @fclose($check); echo "online"; exit; }else{ echo "offline"; } ?> so this script works, but how can i make the script that i can ...

How can we get details from twitter and facebook using PHP

Hey How can we get details from twitter and face book using PHP suppose think that i am developing a site which have Twitter and Face book Log in, i will have only a user name not so much details,that's why i am asking, how can i get details like, DOB,Address,Current Town, Country So on ...

how to show youtube video thumbnails

hi guys, my site lets users upload the youtube video codes. I am trying to make playlist by showing the thumbnails of the uploaded videos and play the respective video after clicking on specific thumbnail. i would like to know the method of getting the caption and the thumbnail pictures of those videos which has been uploaded using emb...

Simplify PHP DOM XML parsing - how?

Hi coders! I've spent whole days with PHP's DOM functions but i can't understand how it works yet. :( I have a simple XML file that looks okay but i cannot use it how i think when i've created it's structure. Sample XML fragment: -pages //root element -page id="1" //we can have any number of pages -product id="364826" //we...

pdf problem in joomla on live server

AOA I am facing pdf problem in joomla. when i click on pdf icon it opens the pop up and show the pdf in wrong format. i think it does not pick the fonts. the pdf is generated something like this fomat. %PDF-1.5 3 0 obj <> endobj 4 0 obj <> stream x��XMsG��~�\R�T�5, �7+��QbGX�r*$XkyL�?�~�O9��u��^�*�b����_�ll_4�n�n�����O���٫�m��f�'�dx�f�...

wordpress add settings to user page

I would like to add a field to the user profile edit page in wordpress. The field should consist of one checkbox and should only be edited by the 'admin'. Does anyone have an idea where I can find this or how I can do this? I have searched through the entire Wordpress codex however i couldn't find anything helpful.. Thanks a lot! ...

How to know which route was selected?

Hi everybody, I have created a function in the bootstrap to do the routing. Once a route has been selected I would like to know which one it is. Ideally I would like to be able to get that information in the bootstrap too, let's say I have a 1st function _initRouting() which decides of the routing and then later in the bootstrap a 2...

fsockopen() returns null pointer, and $errstr is empty (no error message)

[Edit] I have reedited the previous question - since I had misunderstood what was causing the problem - and therefore the ample snippet I had before was a red herring. Thanks to wimdvx, I have a clearer idea as to what is going on. First of all, I am using code that is base on this one, to handle IPN notifications from Paypal. I was u...

Text email template in using Zend_View losing line breaks

I'm using Zend_View to template text email content. However, I've come across one problem which I have been unable to solve: If a line ends with a php block (?>), then the line break is lost. Does anyone have any idea how I can solve this? The application is using Zend framework, but I have no particular reason to use Zend_View to rend...

regex int or float

Hi, My regex won't work on single digit number /^[0-9]{1,7}\.?[0-9]{1,2}$/ I need it to work on unsigned numbers: 1 (single digit numbers, without fractions) - currently it fails on them 1.0; 0.31 (floating point numbers) Number before fraction can be 1-7 digits; after fraction 1-2 digits. Thanks you! ...

Using php to create a zip file

Hi Using the Create ZIP File PHP class I have the following line of code $createZip->get_files_from_folder('blog/wp-content/themes/', 'themes/'); Am I right in thinking that this code gets the files and sub directories from 'blog/wp-content/themes/' creates a new folder entitled 'themes', and then puts these files and sub directories...

javascript redirecting to main window doesn't take into account http option (&)

hello, i'm triying to use javascript redirect to main window after log in succeed in an iframe. this is my code : if ($_GET['redirect']!='') { $redirect=$_GET['redirect']; $smart->assign('redirect',$redirect); } $redirect=$_GET['redirect']; echo $redirect; if(isset ($_SESSION['user'])&&$_SESSION['user']!='') { $user->...

nested foreach with iterator interface

<? foreach ($this->criteria as $key => $value): ?> <li><?= $this->accommodationsLink($this->criteria, $key) ?></li> <? endforeach ?> This code give unexpected results, because only one link is visible. But there are two items in $this->criteria. I explored the cause of the probleem. In the function accommodationsLink is another foreac...

How to redirect a subdomain in htaccess that has no subdirectories

I have searched on google and stackoverflow for a while, but didn't really found an answer to my question. I want to redirect admin.domain.com to www.domain.com if there are no subdirectories or queries. Examples that should redirect: https://admin.domain.com http://admin.domain.com https://admin.domain.com/ Examples that shouldn't re...

MySQL: OUTER JOIN and COUNT()

I have table 'posters', table 'reviews' and table 'trailers'. Every table is connected with an movieID column, but each table can be empty for certain movieIDs: ++ posters_table +++ ++ reviews_table ++ ++ trailers_table ++ --itemID--+--filename- --itemID--+--review-- --itemID--+--trailer ---------------------- -----...

create main page with codeigniter

Hi, How can i create a main page with codeigniter? That page should contain a few links like login, register, etc. I followed a tut to create a login screen. But it made codeigniter only for that purpose. This is the site i'm talking about: http://tutsmore.com/programming/php/10-minutes-with-codeigniter-creating-login-form/ So basic...