php5

Reformat Custom Date in PHP

So I know how to format a date in PHP, but not from a custom format. I have a date that is a string "YYMMDD" and I want to make it "MMDDYYYY'. strtotime doesn't seem like it would do a good job of this when the MM and DD are both low digits. What is the best way to do this? ...

Best Matched function for PHP HttpRequest Class in C#

I am developing an App where I would need to perform HTTP Request using C#. Had in been PHP, I could use the HttpRequest class. Which class or group of class is best matched for the PHP HttpRequest by which I could make GET and POST Request. ...

Client Login API

I have created the function below to check is the auth code is valid with Google, but could anyone point me in the right direction on how to actually grab the users details from there account using the API such as their first name and second name. function check_google_auth_code($authtoken){ /* * Returns The HTTP Cod...

How does one check for remote file size and date ?

Is there a way in php to check remote files size and date/time on the server ? ...

Verifying a CSV file is really a CSV file

I want to make sure a CSV file uploaded by one of our clients is really a CSV file in PHP. I'm handling the upload itself just fine. I'm not worried about malicious users, but I am worried about the ones that will try to upload Excel workbooks instead. Unless I'm mistaken, an Excel workbook and a CSV can still have the same MIME, so ch...

Is there an unlimited API for finding Latitudes and Longitudes given an address?

I am using an API for find Latitudes and Longitudes from address dynamically. The address comes from a database. Now I am using Google's API for this but there is a limit of 15,000 records per day. I have 50,000 records in my database and this may increase in the future. So I want an API which can convert as many records (address to La...

How to identify curl request

Is there a way to detect in my script whether the request is coming from normal web browser or some script executing curl. I can see the headers and can distinguish with "User-Agent and other few headers" but in curl fake headers can be set, so i am not able to track the request. Please suggest me ways about identifying the curl or othe...

How to use shell_exec() function in a php domain?

i found shell_exec() function is disabled in my remote server.Is there is any other way or tips to execute the shell_exec() function? ...

how to differentiate external and internal hyper links in php?

how to differentiate external and internal hyper links in php? ...

Enable SQLite3 in PHP 5

Hi, I am trying to install sqlite3 for php5.2 in debian. in php 5.3 sqlite3 is enable but in debian php 5.2 is the last stable version! Can I enable and use sqlite3 even so? thanks for ur answer! ...

Best way to pass string to function ?

What's the best way from security perspective to pass string to a function. I know I can use globals, session and in function string. Like function test($string). What's the best approach ? If any one knows please let me know. I'm trying to write something like this for example: $url = 'http://domain.com/'; function test() { echo $u...

Select a tag from multiline html code using preg_match_all

Hi all I want to use the php function preg_match_all to find a part of the html code to replace it by another one. This is what I need to find: <attachfiles> tag{link} attr{rel="stylesheet" type="text/css" media="screen"} sources{ file1.css, file2.css } </attachfiles> I made a regular expression that find it but only if that code ...

custom controller name in CakePHP

Hello guys I am developing an application in cakephp, I have to provide a user page for each user in the site like www.example.com/username, username will changes for each user, when a visitor comes to this url he gets details of the user with that particular username, but in cake username tries to get the controller with that name, How...

Is there an equivalent to a member-wise initialization list in PHP?

I'd like to start with a little background, in case anyone has any better ideas for design. I'm looking to create a database class that connects to a database at construction. I would use functions to call the database, to get what I want. The database connection would be closed at destruction. Since I'm connecting in construction, I'd...

Whats the difference between __construct() and init()

Hi All, I was wondering what is the difference between __construct() and init() functions in a PHP application, more particularly in a Zend Framework application. ...

PEAR Channel why do I need one?

So I guess a PEAR channel is like a server that lets you distribute your own PEAR packages? I was under the impression PEAR was sort of dead, until I started looking at Symfony (is it dead? I haven't used it in the past so maybe someone with more experience in PHP can comment on its state and whether it makes sense to invest any time in ...

Class Not Found, but its static methods work

I've stared at this for two hours, and I'm sure there's a decent reason this is happening, but I can't figure it out. <?php error_reporting(7); //warning & parse include($_SERVER['DOCUMENT_ROOT'].'/echo/EchoApplication.php'); $db_credentials = array( 'host' => 'localhost', 'user' => 'db_user', 'password'...

[PHP] extract a line matching a phrase

hello, I want to match a whole line matching a word/phrase on that line! I tried this: preg_match("/PHRASE/i", $dictionary,$matches); But I get only the matched word! but I need that whole line! And there more than 15K lines! So I am looking for best way to do it! thanks in advance! ...

php memory_limit issue

hi, one of my script required large memory. and probably because of this I am getting following error Fatal error: Out of memory (allocated 42729472) (tried to allocate 32 bytes) I tried to change memory_limit by using ini_set('memory_limit', '256M'); on the top of my page but still I am getting same issues. I also tried ini_set...

Steps need to followed before integrating a Payment gateway in my website - php ?

What are the steps i need to follow before integrating PG into my website ? 1) What is the best PG, i juz know only paypal 2) My website will be accessed internationally, so what are the Major credit cards used like VISA, MASTER CARD, AMERICAN EXPRESS ETC ETC if anyone can provide me the link, its more then enough...i can go though it ...