php

recieving XML data via POST then displaying it

I am having difficulties figuring this out. I can see i am posting XML and i see the length of it but i cannot figure out how to display or access the POST DATA CONTENT-TYPE: text/xml<br /> CONTENT-LENGTH: 640<br /> separately i have curl -k -H 'content-type: text/xml' -d 'XML_DATA_HERE' https://ip/page.php ...

Debug PHP scripts using Eclipse

I've been using Eclipse 3.4.2 with PHPEclipse and Zend Debugger for some time without issue. Suddenly, I cannot debug the PHP scripts. I can run them fine but when I select Debug As... the script shows in the Debug window as if it were running, but it is not. If I click pause it reports as being on line 0. I can step through it, if I ...

php create file and send as attachment without actually creating the file

I know how to read a file on the server and attach it to an email in PHP, but I wanted to know if I could attach a file that is created by my script but not created on the server (kinda like a temp file). So create file in memory and attach it to email. Bonus: might need to create multiple files as well, would this be too much for the...

Organizing Classes in PHP

Suppose I've the following classes in my project: class Is // validation class class Math // number manipulation class Now, if I want to validate a given number for primality where would be the logical place to insert my Prime() method? I can think of the following options: Is_Math::Prime() Math_Is::Prime() ...

Calculating roots with bc_math or GMP

I'm having trouble calculating roots of rather large numbers using bc_math, example: - pow(2, 2) // 4, power correct - pow(4, 0.5) // 2, square root correct - bcpow(2, 2) // 4, power correct - bcpow(4, 0.5) // 1, square root INCORRECT Does anybody knows how I can circumvent this? gmp_pow() also doesn't work. ...

Namespace or something else to avoid name conflict with Kohana's Image library

I have a custom helper whose class name, Image_Core conflicts with Kohana's Image Library ( I can use the Library anywhere except inside my helper ) Is there any other way to call the Image Library, like a namespace or something? ( well, it isn't in a namespace, as I just checked ) or will I have to rename my helper? Thanks! NOTE: n...

PHP mysql_real_escape_string() -> stripslashes() leaving multiple slashes

I'm having issues escaping/stripping strings with PHP/MySQL - there always seems to be redundant slashes. Let's take the following string as an example: <span style="text-decoration:underline;">underline</span> When adding a string to the database, I'm escaping it with mysql_real_escape_string() and the following gets stored in th...

Q & A php script

I am writing a simple Q & A for my organization internal usage. It does not have to feature rich like SO. Something much simpler. How do I begin? Is there a script available I can use off the shelf? ...

URL rewriting- How can I turn example.com/pageid.php?id=12 to example.com/full-title

I want to make my pages search engine friendly and it also looks better that example.com/pageid.php?id=12 I have pages different pages like showUser.php showLocation.php and I want all these to be rewritten. Wo'nt mod_rewrite slow down my app a little bit? ...

Possible to view method/function docs in NetBeans for PHP?

I am wondering if its possible to have Netbeans display PHP Documentation for functions/methods/classes when you hover the mouse over a piece of code. I know it shows up documentation as a part of code completion but I don't want to have to start typing out the name of a function which is already included within the source just to read s...

phpFlickr and getting images from Flickr

Hiya, I'm trying to pull in images from Flickr using the phpFlickr library but the docs seem to be quite vague and the results aren't as good as i would like, i wonder if anyone can shed some light on my code (maybe i'm using the wrong syntax?). It works for some queries mainly 1 word queries, i.e. if i send the $tag "inter" it will fi...

Parsing stdClass Object data in php

I'm an intermediate PHP programmer, but am struggling with the output of the Google AJAX API. I have the following converted to stdClass stdClass Object ( [responseData] => stdClass Object ( [results] => Array ( [0] => stdClass Object ( [GsearchResultClass] => GwebSearch [unesc...

How to get Haskell syntax highlighting on PHP blog

Hi, I'm making a blog in PHP and I'd really like to have syntax highlighting on Haskell code. Are there any tools for that out there? I've found hscolour but I don't know if it's possible to integrate it in PHP. I'm using CakePHP if that makes a difference. Thanks. ...

Performance: PHP and MS SQL Server: SQLCMD using Exec or Driver

Hello all, I am currrently making queries to my SQL Server using SQLCMD and I run this from PHPs exec() function. I was hoping to clarify that this isn't as efficient as the driver for SQL Server for PHP: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx. I am not sure if this is the same as http://us3.php.net/manual/en/book...

How do I use OAuth with PHP and cURL?

I'm trying to authenticate to YouTube via their Data API and simply need to know how the headers should be translated from their example (below) to PHP+CURL function calls. The confusing part being the Authorization portion, which breaks name/value pairing with its own set of name and value pairs. This documentation is all well and goo...

How to check for data in a Mysql database using PHP?

I was wondering how can you check to see if certain data is present in a database and if so display it on the web page and if not don't display it using PHP. ...

Update a gallery webpage via Dropbox?

I'd like to know if the following situation and scripts are at all possible: I'm looking to have a photo-gallery (Javascript) webpage that will display in order of the latest added to the Dropbox folder (PHP or Python?). That is, when someone adds a picture to the Dropbox folder, there is a script on the webpage that will check the D...

PHP return value from decoded object

Hi, Can someone please tell me where is the error in this code?, I use a mobile iphone application to call a php script tha will send information to apple. Apple then will return a JSON object containing several values in an associative array. I want to reach the 'status' value but every time I run the code in the phone, the php script...

PHP and C# communication with Encrypt/Decrypt

Hello, I have been searching and cant find a consistent solution to my problem : I want to encrypt something in C# and decrypt it in PHP but also be able to encrypt in PHP and decrypt in C#, using the same key on both ends. All the solutions I found dont seem to work both ways, most of them only work on one language and then fail on th...

Where is some good example code for PHP photo upload?

Nobody seems to have tied together all of the example code in various StackOverflow questions into a good, well-put-together sample of how to handle a photo upload. Here's my start... please help improve it. Here's our setup: Our file upload control is named $file, e.g. <input type="file" name="<?= $file ?>" />. We want to save the ph...