php

Update facebook status via SMS

Hello I am developing a SMS application for updating facebook status in PHP. I can collect username and password of user. I know it can be done by Status.set ,but how can I use the username and password and get the necessary session key and as such. Please help. ...

php & CURL - how to

I am "playing" with an idea, but it might use curl which I am not too sure about, but can fathom my way round most. I can curl a page and get the contents - that's OK, but can you curl a page and get "specific" contents say a variable string or array? Reason for asking is I do a lot of updating to a few sites but most of that is "commo...

mysql timestamp convertion

What is the correct way to convert from mysql timestamp (YYYY-MM-DD HH:MM:SS) to my own chosen format, something like "August 5, 2010"? iow how can I make the mysql timestamp php date() compatible? ...

Convert Object to String

Hello! I have an object which gets a String. I want to compare it with a String and I don't know how to do it. My source is something like it: $field = $this->form->getFieldset('profile'); $website = "Web site"; if ($field->label == $website){ echo "good"; }else{ echo "bad"; } ...

PHP: Trim every element in an object and if empty, set to N/A

I have an object: stdClass Object ( [Color] => Red [Shape] => Round [Taste] => Sweet ) I want to trim each of the elements in the object and if that element is empty, set it to 'N/A' So this object: stdClass Object ( [Color] => Red [Shape] => [Taste] => Sweet ) Would become this: stdClass Object ( [Co...

youtube api i am not able to get video file size

please help me find out the fileSize of youtube video for example $feedURL = 'http://gdata.youtube.com/feeds/api/videos/' . $videoId; // read feed into SimpleXML object //load the video file details into xmlObject $xmlObject = simplexml_load_file($feedURL); // $media = $xmlObject->children('http://search.yahoo.com/mrss/'); ...

How to pull data from xml and break it in pages (pagination)

Hey everyone, I am using simplexml to pull data from an external xml source. I have got values even for limiting the number of results to display. I thought I could paginate with a simple query within the URL, something like "&page=2" but it is not possible as far as documentation shows. I downloaded a pagination class intended to use w...

WordPress plugins and problem with magic_quotes_gpc

Hi, I want to write some plugin which adds forms in administration panel and in blog posts. I'm struggling now with magic_quotes. First I've tried to use magic_quotes_gpc as in clear PHP. But it looks like WordPress ignores this flag and always quotes submitted form contents (at least forms in posts, forms in administration panel are no...

$_FILES empty when trying to do a file upload.

This is driving me crazy. I'm trying to figure out how to upload a file. I've got two very simple files, yet it doesn't seem to work. This first is the file that allows the user to choose the file: <html> <head> <title>File Upload Form</title> </head> <body> This form allows you to upload a file to the server.<br> <form action="getf...

How does one specify pathnames correctly in PHP?

I'm doing a little home computing project in PHP and am creating references like this... <a href=\"list_beer.php?order_by=name\">Beer</a> This seems to pick up the right file. When I do includes, I seem to need a pathname. include_once ("/var/www/common.php"); I'm sure this can't be right. Perhaps you could tell me what is the best...

PHP - filename calls function on different script, get filename from script containing function

fileA.php: requires function.inc.php and uses x() from that include file fileB.php: requires fileA.php User invokes fileB.php to get fileA.php function.inc.php: function x() - returns filename that invoked it What is the PHP server variable or whatever that gets the name of fileA.php from within function.inc.php? Usecase - function ...

Codeigniter first segment URL variables

I am looking to use a URL shortening scheme where I would like the variable to be in the first segment of the URL, www.example.com/0jf08h204. My default controller is "home.php" and I have .htaccess mod-rewrites in place, so what is the best way to manage this? I suppose my smarts have been blocked by the standard /controller/method/vari...

Dynamic Form Action - Determine Action With Variables

I have a form in CodeIgniter, and I need to change the Action of the form based on what is in the actual form. ie: if <select name="type"> == business then I need action="business/submit" Is there a simple way to do this? Right now my attempted workaround is to use Javascript to grab the data from the inputs, then send it to a dynamic...

php var_dump() vs print_r()

What is the difference between var_dump() and print_r() in terms of spitting out an array as string? ...

PHP Output Words Not In String

I have two strings: $string = shell_exec('reg.bat '.$arg); //returns word\0word\0word $stringA = "$string"; $stringB = "word,other,word2,other2"; $array1 = explode('\0', $stringA); $array2 = explode(',', $stringB); $result = array_diff($array1, $array2); I can use array_diff to find the differences, but the last word shows up as not i...

Match a PHP class with a Regular Expression

I wanna catch Php classes from a file: class a { function test() { } } class b extends a { function test() { } } and the result matches must be class a { function test() { } } and class b extends a { function test() { } } ...

managing user session for a website for lifetime.

Hi, I want to manage a username session for lifetime. means for example if u look a website http://www.kongregate.com/ in this website i have registered and i haven't logged out but whenever i open up this website my username appears there. No need to login again. so i want to do the same for my one of the games website. i have develope...

How to run a function within an echo call

Guys, This is a quick but simple question. I am having a bad day and don't know how to do this: What I need to do is this... I am checking for PMD in the url if so echo this: <?php if ( isset($_GET['pmd']) ) { echo"<div class=\"response\"><p style=\"width:350px; height:200px; vertical-align:middle;\"><strong>Thank...

how to redirect URL in PHP using .htaccess?

hi all, how to redirect a url in php? if i use htaccess to redirect, then its asking me a authentication (username & pwd). i want to redirect to url without any authentication. is it possible in php. i dont want to use headers or meta tags or window.location to relocate i.e redirect. any other way is possible? thanks in advance. ...

Why does filter_var($email, FILTER_VALIDATE_EMAIL) allow test@test?

I was just setting up the validation for a form in which I decided to try using the filter_var function to check the validity of my email address. I can not find out what filter_var actually allows anywhere though (since the documentation is very simple), and I found out that it is allowing an email address like test@test. Doesn't there ...