I'm new to XMLReader and novice at PHP. I'm trying to figure out how to use XMLReader to parse XML files. In particular, I'm trying to grab particular nodes of a very large XML file so that I can rewrite a smaller file with just the subset of nodes I need. So, XMLReader seemed appealing for its supposed speed with $reader->expand().
...
Thanks to AakashM, he led me in the right direction. For the question below, this is the xPath expression that led me the right way:
"//channel/item[category[@domain='http://www.somelink.com/?category=4']]"
Original post:
I have an XML feed that looks something like this (excerpt):
<channel>
<title>Channel Name</title>
<link>Lin...
I'm having an issue with inserting JSON into a database, my intention is to take the variables, json_encode them, remove slashes (from magic_quotes), and then addslashes back in to escape the quotes in {"key":"value"}
Unfortunately, strip_slashes on the encoded string isn't doing anything, and outputs this
{"content":"<p>This string ha...
in my php I evaluate the the filesize
if (($width !=1600) || ($height
!=1100)) {
echo "wrongsize"; }
else { echo "justright"; }
in my file i try and evaluate the the response to update the html
'onComplete' :function(event, queueID, fileObj, response, data)
{
if(response == "wrongsize") {
$('div#uploadError').ht...
I am building a Zend Framework application that performs jobs submitted by the user. The actions taken need to be logged to a database. I would like to correlate the job with its log entries.
Instead of creating my own logging class, I would like to extend Zend_Log since it provides 99% of the functionality that I need. All I need to...
works fine on the desktop with xampp but when i upload it to my webhost it doesnt. The file x.csv is in the same dir
$csv_file = "x.csv";
$handle = fopen(($csv_file), "r");
the error i get is-
fopen(x.csv): failed to open stream: No such file or directory in /var/www/html/x/admin/import_one.php on line 12
Where am I going wrong?
...
Hey guys
I made a slug with dash for my stories URLs such as:
http://stackoverflow.com/questions/482636/fetching-records-with-slug-instead-of-id
This is my code to create slug :
function Slugit($title) {
$title = strip_tags($title);
// Preserve escaped octets.
$title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1--...
Many of the component libraries and toolkits I'm familiar with lack CLI-specific libraries (zend, kohana, etc..). Are there any libraries/tools that are designed specifically for developing CLI application (such as an abstraction of php's multi-threading library, pcntl/posix)?
...
I am on a LAMP stack for a website I am managing. There is a need to roll up usage statistics (a variety of things related to our desktop product), and I initially tackled the problem with PHP (being that I had a bunch of classes to work with the data already). All worked well on my dev box which was using 5.3
Long story short, 5.1 memo...
I'd like to use wp_insert_category() to create a category that's displayed as "My Category" but has a category slug of "test-my-category".
Can I do this with wp_insert_category? Anyone have an example?
...
I'm looking into using the ImageShack.us API for uploading images from my website. I found this tutorial for using it with the XML return http://elliottback.com/wp/using-the-imageshack-xml-api/, but I'm not sure about what to do with it. Where do I enter my API key for this script? Furthermore, he shows the use of two PHP files - should ...
I am resizing PNG images using the GD image library function ImageCopyResampled(). It all works fine, I can even keep alpha blending transparency with the use of ImageCreateTrueColor() rather than using ImageCreate() to create the resized image.
The problem is, that if I use ImageCreateTrueColor() rather than ImageCreate() the file size...
Hello everyone,
I'm working on a webapp where I want to match some crc32 values that have been generated server side in PHP with some crc32 values that I am generating in Javascript. Both are using the same input string but returning different values.
I found a crc32 javascript library on webtoolkit, found here. When I try and match a ...
Example array
$myArray[0] = array('23', null, '43', '12');
$myArray[1] = array(null, null, '53', '19');
$myArray[2] = array('12', '13', '14', null);
All nulls should be replaced with 0. I was hoping someone would have an efficient way of doing this, perhaps a built in PHP function that I am unaware of.
...
Hello,
I need to include the content, scripts, forms and dynamic abilities of one page in another onClick.
Take a look at http://www.divethegap.com/scuba-diving-programmes-dive-the-gap/dahab-master-scuba-diver.html
Then follow one of the links that says 'Beginner' 'Open Water Diver' etc....
You will find a PHP page with a series of o...
Hi,
I use Zend forms in my web application. I wonder where Zend puts
uploded temp file by default ? I can't find it in server tmp dir. For example if
I upload image(1.jpg) via file field, it appears on tmp folder, but as 1.jpg(/tmp/1.jpg). But I need temporary file like /tmp/phpeZApBn. Maybe it is in any other location ?
Any help woul...
Hi !
How can i get the number of each filter item in a seach?
Example... im doing a job/resumes portal... i seach a job title and i have some filters items like City, State , area and etc... How can i show the number of each filter in the select box example Contry: Brazil(22 results), USA(61 results)
Here a url with a sample:
http://w...
is there any solution to show user all countries and after select country it reselect all cities of its country? be best with script selecting
p.s. russian name of countries
...
Hi not sure if this is the right forum for this but does anyone know the formula for converting decimal time in to hours and minutes ?
IE 1.4 = 1hr 24mins
thanks for any help and sorry if its the wrong forum
...
My PHP experience is rather limited. I've just inherited some stuff that looks odd to me, and I'd like to know if this is a standard way to do things. The page which shows up in the browser location (e.g. www.example.com/example_page) has something like:
<?
$title = "Page Title";
$meta = "Some metadata";
require("pageheader.inc");
?>
...