I have a blog (wordpress) and a facebook fan-page for my blog (with more than 1 fan!). I would like to post a message to my FB wall, every time I post something on my blog. Preferrably PHP.
The same question is already asked here, but this question isn’t going anywhere. The question dates from march, but Facebook has updated their API s...
OK, so I have a new project with me, it is basically on solving logical and reasoning type of problems. Like in maths you are given a figure and asked how many triangles are in it. What I have to do is.
User enters a code and a word. example
word -> example
code -> aesxxasskmpaalee
here if we remove certain characters, we can form exa...
How should I prepare the code if it something fails? With try-catch statement or?
function delete_question ( $question_id ) {
$dbconn = pg_connect("host=localhost port=5432 dbname=heoa user=heoa password=123");
// removes questions and its dependencies: answers and tags
$result = pg_query_params ( $dbconn,
'DELETE F...
The legitimate users of my site occasionally hammer the server with API requests that cause undesirable results. I want to institute a limit of no more than say one API call every 5 seconds or n calls per minute (haven't figured out the exact limit yet). I could obviously log every API call in a DB and do the calculation on every request...
I am in a bind, multiple times on a page for different form items, I insert a css div class into a form item ONLY if an error_array key exists, this is how I highlight a form item that has an error in it.
Works, great if I have an error because then my error array is set, problem is before an error is set, it tries to look for an array ...
Coming from a .net background so bear with me!
Does php have anything like a web.config or a global.asax file or is it simply dropping the application in the file system and boom it is running on the web server? (obviously dropping the files mapped in apache for the domain etc).
Specifically thinking of setting up wordpress.
...
How would one get the root DNS entry from $_SERVER['HTTP_HOST']?
Input:
example.co.uk
www.example.com
blog.example.com
forum.example.co.uk
Output:
example.co.uk
example.com
example.com
example.co.uk
EDIT:
Lookup list is very long
...
I have a class with static methods, and I would like to intercept method calls before the methods are called.
So if I call
$model = DataMapper::getById(12345);
then I want some method in DataMapper to be called before this method is called, and then optionally this intercepting method can subsequently call self::getById(12345). Is t...
This is a similar question to this one. I would like to convert ANSI escape sequences, especially for color, into HTML. However, I would like to accomplish this using PHP. Are there any libraries or example code out there that do this? If not, anything that can get me part way to a custom solution?
...
My site uses a php function to tweet an update whenever an event occurs. Right now I'm using the classic login technique, so the username and password for the associated Twitter account are just hard-coded in. The function looks like this:
function sendTweet($msg)
{
$username = 'username';
$password = 'password';
$url = 'http://twitt...
ok, so I put together a very basic mail function and while testing this, I used a couple of email accounts, one my google account and the other my work account. I get all emails at the google account, but not to those pointing at my work. I'm thinking that could be because they have been caught up with the anti-spam software. Any ideas o...
Here is what I am trying to do:
<?php
$my_str = "My String";
$str = "%my_str";
$str = str_replace("%", "$", $str);
echo $str;
?>
The above code prints '$my_str' to the screen. But I want it to print 'My String', as in the actual value of the variable $my_str
Anyone know how to do this?
The reason I want this is bec...
I sense an easier way to do the code. How can I do the deletion/insertion shorter?
// to delete the old tags before inserting new tags
$result = pg_query_params ( $dbconn,
...
I am trying to fix a project that someone else coded, it is a mess!
On an edit user profile page they have something like this below which will list all available radio select boxes for the options a user can select for there education level, this is just 1 item, there is many items like it so based on the answers here, I can apply it...
I'd like a reg exp which can take a block of string, and find the strings matching the format:
<a href="mailto:[email protected]">....</a>
And for all strings which match this format, it will extract out the email address found after the mailto:. Any thoughts?
This is needed for an internal app and not for any spammer purposes!
...
Thanks in advance
Jon
...
Hi:
I client of mine, have 542 php files (yes a lot) each one of them call a iframe with certain parameters every one different.
So i wanna make this a little more efficent, and convert all files to a database, but for this i need to obtain 2 things
The contain of the title tag
One parameter of the iframe (cat)
I show the iframe exa...
I am in the process of making a website that involves a shopping cart.
There are two major requirements:
The user experience guys want login/authentication to be the very last step in the entire work flow. The user gets to do all the shopping and is asked to login only at the time of checking out.
The shopping cart shouldn't expire(n...
When inserting a row in mysql database, string values need to be enclosed in quotes where integer don't need to.
Is there any class or library that takes care of this automatically so that I can just pass to a 3rd-party function an array of fieldnames and values and don't have to worry about putting string values in quotes?
Thanks,
...
I'm trying to define a new shortcode in WordPress, and I get the following error when the function is loaded (just loaded, I haven't tried to call it anywhere yet):
Parse error: syntax error, unexpected T_STRING in /pathtomytheme/user_functions.php on line 105
Here's the code; line 105 is "$cat_n = count($cats) – 1;":
function user...