php5

cURL and SimpleBrowser

I have a script that lets me log into xbox live using simplebrowser. How ever the browser detector on xbox live takes me to a blank page after log in that has an empty form that needs to be submitted. But the form doesn't show on my browser so simplybrowser can't find it to submitted. The creator of the script says I need to use cURL, ho...

How to prevent input field inside form from submitting when enter key is pressed?

I have a simple form. Input fields, checkboxes, radio buttons and finally SUBMIT button. I use jQuery to perform AJAX validation, however when a user presses ENTER inside the input field it submits the form! How do I stop this from happening on this form (not all input fields)? ...

How to get query created by the prepare statement in PDO

Hi all, We can use prepare method to get the query prepared for multiple time use in PDO. But i want to know that can we see all the queries executed at the DB. For e.g see below: <?php // Cosidering DB connection already set here. With $db. // using named placeholder $db->prepare("select * from user where id=:id"); ...

Problem editing word file in PHP

So I need to edit some text in a Word document. I created a Word document and saved it as XML. It is saved correctly (I can open the XML file in MS Word and it looks exactly like the docx original). So then I use PHP DOM to edit some text in the file (just two lines) (EDIT - bellow is already fixed working version): <?php $firstName =...

PHP convert string to array

How can I convert a string to an array? For instance, I have this string: $str = 'abcdef'; And I want o get: array(6) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" [3]=> string(1) "d" [4]=> string(1) "e" [5]=> string(1) "f" } ...

Removing objects form serialize data

I am trying to integrate two PHP scripts (app1, app2) and I am trying to get session data from app1 in app2. The problem is when I am trying to unserialize the session data from app1 I am getting a small ton of errors because PHP is trying to find the __wakeup() function for each of the objects. I can't use the unserialize_callback_fu...

How to read multiple files in parallel?

I have a number of text files that I need to open, then allocate certain fields to set strings inside PHP to eventually write into MySQL. Each txt file does have the same unique value for app_id, eg So text file 1 has app_id name description text file 2 has app_id category text file 3 has app_id price I want to get name, descript...

The timestamp to dates problem for PHP >= 5.1

I may say I'm not a PHP programmer. I've been reading at http://php.net/manual/en/function.date.php that: The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer). How...

Help me refresh this please

After hours and hours of searching I finally found an api script for gamercards. Only problem is this freaking thing updates every 30 mins. If I open a new browser and go to the url I get the most recent updated info. Is there a way to trick this thing to think each refresh is a new browser session? http://xboxapi.duncanmackenzie.net/ga...

cURL is returning 404 on a file that exists (remote server). Why?

I'm checking to see if certain mp3's exist. While sometimes there's no problem, certain valid mp3 files are shown as 404, not found. Here's the code I'm using: $ch = @curl_init($file_path); @curl_setopt($ch, CURLOPT_HEADER, true); @curl_setopt($ch, CURLOPT_NOBODY, true); @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); @curl_setopt($ch,...

Fusion Charts Formatting data values

I am wondering whether there is a way to format the fonts for my datavalues. I have two sets of data that I want to plot on the same graph but I want to format the data values differently. ...

Spawn a process with php doesn't work

Hi, I tried to start a background process with php, for that, I added a & at bottom on exec function but after a few days it stop working. Basically If i have file 1.php with: <?php var_dump(exec('/home/2.php > /home/2.output 2>&1 &')); And file 2.php with: <?php sleep(5); echo "Fill\n"; Running file 1.php, it return an empty st...

Best way to get the contents of TITLE TAG from page URL

Given a URL. What is the best way to get the contents of the title tag in the URL. Basically I want to check for the http_referrer and if it exists give a link back to the referring page. But I would like the link to say the title of the referring page. ...

How can I access a REST data source from a PHP framework?

We are looking to build a PHP web application to manage data that is available only through a 3rd party REST like interface. We would like to use an existing PHP framework to do this, we're considering cakephp and codeigniter, but are open to other options. We expect the biggest problem will be creating models that utilise the REST...

Is it possible to use a static private method of a class as callback?

I saw code that contained the following line: preg_replace_callback($regex, 'TextileParser::replaceAnchor', $text); where TextileParser::replaceAnchor() is a private static method. Is that possible, or the code is wrong? ...

PHP + jQuery - How to form submit, process and redirect on success?

Hi All Stupid question (I seem to be leading all my questions with this phrase), but I was wondering if anyone out there had an elegant solution for processing forms via php and jquery and then redirects [HTML FORM] --> submits via jquery post to --> [PHP FILE] --> upon success redirects to --> [SUCCESS HTML PAGE] (and if not suc...

Problem replacing LDAP default attribute

$entries = ldap_get_entries($ldapconn, $ldapsearch); // This is my result form ldap server $format = "@sn, @givenname, E: @mail"; // This are new strings to replace ldap defualt attribures. if ( $entries ) { // Check $entries are not empty. # Try to authenticate to each until we get a match for ( $i = 0 ; $i < $entries['count'...

How to access a website only from a specified IP using PHP

Hi all, I need to access a site only from a specific IP address. Is that possible using PHP. The project is under development and some people used that and say "The site is not good". So i like to avoid that kind of things. That's why i need this solutin. Thanks in advance Fero ...

How to display archive from one saturday next saturday range,Wordpress

In my wordpress home page, i am displaying the archives using the function wp_get_archives('type=weekly&format=html') and it outputs like * July 19, 2010–July 25, 2010 * July 12, 2010–July 18, 2010 ie starting from monday to next monday.How can i change this from saturday to next saturday ...

generate 10 digits alphanumeric value in php with first,third,fourth digit must be alphabet

I need php code to generate 10 digits alphanumeric value with first,third and fourth digit must be Capital alphabet and alphabet 'o' or 'O' should not be in generated code. ...