I have a whole HTML string that is being evaluated using PHPDom and it's working perfectly, except I don't know how to do this one thing that seems really basic. I need to select an HTML element via XPath and have that element's content returned as a string. So far, this is what I have. Can anyone point me in the right direction as to ho...
This function is great, but its main flaw is that it doesn't handle domains ending with .co.uk or .com.au. How can it be modified to handle this?
function parseUrl($url) {
$r = "^(?:(?P<scheme>\w+)://)?";
$r .= "(?:(?P<login>\w+):(?P<pass>\w+)@)?";
$r .= "(?P<host>(?:(?P<subdomain>[-\w\.]+)\.)?" . "(?P<domain>[-\w]+\.(?P<ex...
i have this array:
[2] => Array
(
[type] => jpg
[name] => 25.jpg
)
[3] => Array
(
[type] => jpg
[name] => 26.jpg
)
[8] => Array
(
[type] => jpg
[name] => 27.jpg
)
[13] => Array
(
[type] => jpg
[name] => 10.jpg
)
[14] => Array
(
...
Is there a benefit of using one over the other ?
$lang = isset($_COOKIE['lang']) ? $_COOKIE['lang'] : 'en';
# OR
define("LANG" , isset($_COOKIE['lang']) ? $_COOKIE['lang'] : 'en');
Thanks
...
Hello,
I have a main page, index.php and I would like to redirect all URI to index.php despite the existence of the file/directory in the server. Basically, I would like to give priority to index.php over htaccess.
Currently, I have the following:
...
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ...
I'm writing an ad script that loads advertisements to websites across the network. The ad script has to keep a detailed log and serve advertisements. At the very minimum, it should log the number of impressions for each advertiser and the number of impressions for the publishers.
I'm thinking about building the backend on PHP and then h...
this is my php code:
<html><body>Hey!: <?= "World";?></body></html>
It just prints "Hey!:" Whats wrong with my code?
...
I have a custom Auth library in CodeIgniter and want to send data from the signup form to it.
I know to send the data to a controller I do:
echo form_open('login/validate');
and the data is sent to the validate function of the login controller. So how do I send the data to a library rather than a controller?
...
I'm attempting to install CKeditor on Kohana 2. I've dropped the ckeditor folder into libraries/ and put ckeditor.php alongside the ckeditor folder in libraries/. I'm trying to call ckeditor in my controller with the following:
$this->ckeditor = new Ckeditor('FCKEDITOR1');
$this->ckeditor->BasePath = 'application/libraries/ckeditor/';
$...
Hi, i have this html code. Im using Simple HTML Dom to parse the data into my own php script.
<table>
<tr>
<td class="header">Name</td>
<td class="header">City</td>
</tr>
<tr>
<td class="text">Greg House</td>
<td class="text">Century City</td>
</tr>
<tr>
<td class="text">Dexter...
Hello all.
I have spent quite some time making a function and the last 15-20 minutes trying to figure this out. I need help!
I am selecting multiple rows from the database and then running them in a while loop.
They are available on a dropdown menu.
<form method="POST" action="adminprocess.php">
<fieldset>
<p>
<label class...
I've written a script that reads through all files in a directory and returns md5 hash for each file. However, it renders nothing for a rather large file. I assume that the interpreter has some value set for maximum processing time, and since it takes too long to get this value, it just skips along to other files. Is there anyway to g...
I'm trying to set up a system that allows members of my web site to fill out surveys or offers through affiliate links, and then reward the member's profile with points for completing the survey (assuming the survey is correctly completed). These points will be used to purchase prizes on my web site.
My question is: Once the user succes...
Everything I've read says that storing serialised arrays in Mysql is a bad idea - I know that already ;) Unfortunately I'm working with an open source script that uses this method, and changing the structure isn't an option in this scenario.
Is it possible to update this URL without first unserialising?
I originally tried using replace...
Hi Everyone!
For some reason I cannot get the error logging to work, I'm getting the white screen of death and I'm hoping an error log will be able to shed some light on the situation!
My index.php has
error_reporting(E_ALL);
I have also made sure that the system/logs directory has appropriate permissions,
If the page fails to l...
Hello,
I've run in to a problem with a PHP script using SimpleHTMLDOM to pull a list of URLs of a page.
If I specify the URL I want to read the links off, the script gives me no problems:
$url='http://www.example.com';
$blogpost = file_get_html($url);
foreach ($blogpost->find('a[href*=example1]') as $exam...
I am getting a request in the following method but the soap message does not appear to contain the UsernameToken Element:
$policy = new WSPolicy(
array(
'useUsernameToken'=>true
)
);
$security = new WSSecurityToken(
array(
'user'=>$username,
'passwordType'=>'PlainText',
'password'=>$password
...
I want to check if my site's visitors have visited another particular site before coming to mine.
I know how to use JS and PHP to check to see (via referrer info) if the user has just come from that site to mine, but I would like to be able to detect if they have visited this site at any time before (not just immediately before coming t...
How do i sort this array by ssup asc?
[xml] => Array
(
[sale] => Array
(
[0] => Array
(
[ref] => 316205
[line] => 3
[partno] => MC41SS
[cust] =...
Hi!, i'm lookin for a way to make some kind of function into php and mysql who give me as a result the id of a record in a simple table.
I got a id -> value table where the id is an autoincrement field.
The natural way or the simple way i know is:
$myId = Check('Cheese');
function Check($value) {
$sql = "SELECT id FROM table...