I am writing a regex find/replace that will insert a <span> into every <a href> in a file where a <span> does not already exist. It will allow other tags to be in the <a href> like <img>, <b>, etc.
Currently I have this regex:
Find: (<a[^>]+?style=".*?color:#(\w{6}).*?".*?>)(.+?)(<\/a>)
Replace: '$1<span style="color:#$2;">$3</span>$4'
...
Hello,
Does anybody know of an easy way to upload files to a remote server using SFTP from within a Phing build? I cant seem to find a custom or native Phing task to do this. The other problem is the interactivity of the SFTP unix command (requiring a password after reaching host, etc.)
Any ideas?
...
Could anyone recommend a preferred algorithm to use for URL shortening? I'm coding using PHP. Initially I thought about writing something that would start at a character such as "a" and iterate through requests, creating records in a database and therefore having to increment the character to b, c, d ... A, B and so on as appropriate.
H...
Is there any YouTube php wrapper that I can use to retrieve video's rating by their id?
...
I have a web form that users can fill out and that content fills up a PDF with FPDF and PHP. When a user enters a word with an apostrophe, a slash appears before it on the PDF.
Similarly, special characters like trademark symbols are encoded wrong.
The FPDF FAQs say to use:
$str = utf8_decode($str);
But I'm just not sure how to appl...
How should the following boolean expression be written in PHP:
$foo = "";
if($var==TRUE){
$foo = "bar";
}
or
if($var==TRUE){
$foo = "bar";
}else{
$foo = "";
}
or
$foo = ($var==TRUE) ? "bar": "";
...
I am pulling data from the Facebook graph which has characters encoded like so: \u2014 and \u2014
Is there a function to convert those characters into HTML? i.e \u2014 -> —
If you have some further reading on these character codes), or suggested reading about unicode in general I would appreciate it. This is so confusing to me. I...
Hello, I am trying to parse some very basic JSON, but I don't know where I'm going wrong when trying to display it to the screen.
Am I not GRABBING the data correctly, such as, "data.re1Code"?
I hope someone can shed some light onto my basic question sorry.
JSON Data
[
{
"rep1FullName": "Justin Giesbrecht",
"rep1C...
Hi Everyone!
I am receiving a JSON which I can receive using php://input and I need to post it back to a different URL, but I'm not sure how to format it. Here's how I receive it:
$updates =
file_get_contents("php://input");
I could json_decode it and then parse out the array so that it would fit a normal POST-like request such ...
I need a php script that accepts a URL via a get request and I want it to send a request for the URL sending the same headers the visitor used, then return the file using the same headers the server sent.
eg. requested is http://Google.com/
The PHP script sues curl to request http://Google.com/ sending the same headers as the user's bro...
This may seem like a stupid question, but rest assured that I don't need general database help, but MS Access help specifically. This would not be a problem if I were working with any other database.
I need to fish out the primary key(s) form an MS Access table using PHP with an ODBC connection. I have found two PHP functions that suppo...
on my wordpress site http://www.101river.com the edges of elements are rounded but only in firefox, safari and Chrome because Ie does not support css3 the elements are not rounded in IE. I know there are many tricks to make this make corners rounded in IE just don't know the easiest. Can some one please give some example code to make thi...
Hello
I had an php apliccation with mssql2000 (sql server 2000) , I'm using appserv 2.5.9 with apache2 and php5.
I've upgraded my computer to Windows 7 Ultimate x64, and tryied to run the application, but it goes to sloooooooooooooooooooow
Since like 2 years, works perfectly fine (not application problem, and no db problem, works fine...
Hi can anybody tell me how to install PHP-qt on my system local server.
my configuration is --
OS - Widows XP-SP2
server - easyPHP
also is this project php-qt is still "ON" for future , Please send a demo link for it
any alternative for it is most welcome , if there is alternative Please send a demo link and a bit of information. ...
Is it possible to use PHP alternate syntax (as described in the CodeIgniter user guide), on WAMP?
...
Hi guys, I've just run into a little bit of trouble with some PHP on my latest project. Basically I have a block of text ($text) and I would like to search through that text and return all of the MP3 links. I know it has something to do with regular expressions but I just cannot get it working.
Here's my current code:
if(preg_match...
Hi,
I have the weirdest problem I cannot figure out, see the following code:
$frmUsername = $_POST['frmUsername'];
$frmPassword = $_POST['frmPassword'];
if($frmUsername == "" || $frmPassword == "") {
print "frmUsername: " . $frmUsername;
print "frmPassword: " . $frmPassword;
} exit();
The result will be:
frmUsername: fr...
Hey guys, I have been working on a solution/algorithm for a function to calculate a grade based on the grade type (Homework, Exam, Project, etc.). I've successfully implemented the function that gets the information I need to make the calculation, but I'm having trouble constructing the grade calculation function that takes all the grade...
I am using a great Wordpress to store files on Amazon S3 called "Amazon S3 for WordPress" it seems to have a bug with version 3.0+ of Wordpress.
The error I am getting is:
Warning: strpos() expects parameter 1
to be string, array given in
/home/dir/public_html/www.site.com/wp-admin/includes/media.php
on line 310
Here is the ...
Hi all,
I'm trying to highlight the selected text contents by the user inside the HTML page I loaded using PHP + XSL transformation.
I have seen some solutions related with highlighting current selected text, but I need to save some information to the database that makes me able to highlight the same contents for future loads of the sam...