php

php script outputs itself

hi! after submitting a form my php script outputs its code. sometimes not all of it. ...

Character encoding error!

Hi! I try get the content this URL: http://www.chromeball.com, but the character encoding is not good. I have this code: $url = 'http://www.chromeball.com'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $data = curl_exec($ch); curl_close($ch); $dom = new DOMDocu...

How to combine image and text on the fly in php

hi, i want to combine text and image on the fly to create a jpg widget. I want to do this for a fundraising website, i will need to update the image once a day so it reflect the updated fundraising progress bar. The reason why i want a jpg (image) widget is because it is much more friendly to add to blogs, website etc. ...

Detecting IE browser version using PHP

I'm using $_SERVER['HTTP_USER_AGENT'] to detect user's browser. When I run the var_dump on my localhost on IE8 it returns: ...compatible; MSIE 8.0; ... But when I upload it to my host (godaddy), I get: ...compatible; MSIE 7.0; ... What's the problem? ...

PHP - Upload a web hosted photo to facebook album via Graph API

Hi I'm trying to upload www hosted (e.g. http://www.google.se/intl/en_com/images/srpr/logo1w.png) files to a facebook album. Creating an album works just fine, but I don't seem to uploading any photos. I'm using the facebook php-sdk ( http://github.com/facebook/php-sdk/ ) and the examples I already tried are: http://stackoverflow.com/...

Any suggestions on a basic PHP library for doing session management and authentication?

Hi, I am working on a project that exposes a number of web services to the public. Right now I have the serialisation side done (Using ZendAMF) and now I need to do the authentication. I was looking over Zend Session and Zend Auth and they look like they do what I want, but while doing that research I came across a lot of people expre...

Convert a Perl code to PHP

Hi; I need to convert the following perl function to php: pack("SSA12AC4L", $id, $loc, $name, 'ar', split(/\./, $get->getIP), time+(60*60); I use the following code (to test) in PHP: echo pack("SSA12AC4L", '25', '00001', '2u7wx6fd94fd', 'f', preg_split('/\./','10.2.1.1', -1, PREG...

facebook app publish to wall

how do i publish to facebook wall using my app.something like wat mafia wars does. ...

Magento - Help Specifying the Page Layout

Here’s what’s going on: I have a page content for a module rendering in my 3 column layout (which I believe is the default) and I want it to render in 1 column, but I don’t know how. The longer version: I’m using Unirgy’s Dropship Microsite and I’m trying to get the vendor landing page to render in the 1 column layout. My layout xml f...

jQuery/Ajax call - It Doesn't work on IE7

Hi... i make a Jquery function that (for the moment) call a function dinamically and print it with an alert. with firefox, chrome : it works! when i try on IE7 (the first time), it fails. If i reload the page (F5) and retry , it works! o_O I FINALLY understand why that's happen. In my old website i used the jquery-1.3.2.min.js library. ...

How should parse with PHP (simple html dom parser) background images and other images of webpage?

Hi, How should parse with PHP (simple html dom/etc..) background and other images of webpage? case 1: inline css <div id="id100" style="background:url(/mycar1.jpg)"></div> case 2: css inside html page <div id="id100"></div> <style type="text/css"> #id100{ background:url(/mycar1.jpg); } </style> case 3: separate css file <div i...

PDF as mail attachment - mail() returns false, no error

Hi. I've got good code, it used do work. But now I can't make it work. Normal mail() works, but this code doesn't: <?php ob_start(); error_reporting(E_ALL|E_STRICT); ini_set('display_errors', 1); require_once('dompdf_config.inc.php'); $tpl = '<html> <style type="text/css"> .bg1 {background-color:#8FE6F9; font-we...

php sqlite_fetch_array corrupted results

Hi, I started trying to use sqlite to host small websites and on my own personal server, I ran into a glich which kind of spoils the whole idea. I have a very simple test example, on a two row table in a sqlite 2.x database, I am being hosted with 5.2.12, I have also tried with the PDO sqlite3 database, the problem is this. The "users...

Why is PHPUnit in Hudson CI using my localhost path AND my actual filepath?

EDIT 3: Solved. See below. EDIT 2: I think Chadwick's on the right track with his comment. Hudson/PHPUnit is taking the localhost (the Hudson workspace) AND my local file structure and using both to run the unit tests. So it's redeclaring everything that was already declared. Why is this happening and how can I change it? I've since re...

Match only backticks not inside a <code> block with Regex.

First things first. I know how to parse XML/HTML with simplexml, and I know all the arguments against using RegEx to parse it. This question is for the sake of knowledge. What needs to happen In a block of text let's say we have the following line of text: The query you need to use is <code>SELECT `post_name` FROM table WHERE id= $id...

Preferred way to combine PHP and HTML?

I learned PHP by hacking away at phpBB2, even submitting a few mods to their database, which others downloaded and used. (I don't believe phpBB2 is supported any more with phpBB3 out so long now, so the v2 mods database is no more.) One of my favorite things about phpBB was their templates system, which let the editor completely separat...

Regular Expression PHP Help with if not equal to

I am trying to use regular expressions to make my inventory upload script a little better. I sell clothing and accessories. In my inventory file I have a field called ProductDepartment which is a combination of gender/item type. I have a MySQL table for gender with the following values: Mens = 1 Womens = 2 Unisex = 3 Departments in...

Error accessing Facebook API

Since today my app throws this error: Thanks for helping! Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed: Temporärer Fehler bei der Namensauflösung in /var/www/modules/facebook/classes/facebookapi_php5_restlib.php on line 3663 Warning: fopen(http://api.facebook.com/restserver.php?method=facebook.fql.qu...

PHP How to remove numbers like [3][2][4] from string using php

I have a text string that contain some references numbers like [3][2][4] or [1] or [5][7] can you please help me removing all numbers between brackets ex. [4] from that string using regular expressions Regex ? Thanks ...

Sending a simple attached file via PHP mail() function

Hi all, I'm going to give this another try because my last question might have been confusing. I have a simple web form consisting of the following some inputs (for now, pretend i have two inputs, name and file input). I want the user to upload a document (if possible restrict to .doc, .docx, .pdf, if this is not possible to accomplish,...