php

Using PHP to store results of a post request

Im currently working with an API which requires we send our collection details in xml to their server using a post request. Nothing major there but its not working, so I want to output the sent xml to a txt file so I can look at actually whats being sent!! Instead of posting to the API im posting to a document called target, but the x...

How to process large amount of POST data from a textarea?

I am developing a tool where lots of data (>1MB of data) with lots of lines can be copied and pasted into a textarea. When I submit the form it just shows a blank screen. Nothing happens. Is there a way to process large data submitted by a form with PHP like in chunks and pieces? What are the best practices do handle large amount of data...

Pause/Resume Upload in C#

Hello, I'm looking for a way to pause or resume an upload process via C#'s WebClient. pseudocode: WebClient Client = new WebClient(); Client.UploadFileAsync(new Uri("http://mysite.com/receiver.php"), "POST", "C:\MyFile.jpg"); Maybe something like.. Client.Pause(); any idea? ...

Question on session

Once i login, a new session is generated.... how can i later know for which login the session is generated. I am getting the session value, but how to know for which user the session is all about and redirect him to that page. ...

PHP How to distinguish $this pointer in the inheritance chain?

Please look at the following code snipped class A { function __get($name) { if ($name == 'service') { return new Proxy($this); } } function render() { echo 'Rendering A class : ' . $this->service->get('title'); } protected function resourceFile() { return 'A.res'; } } class B extends A { pr...

Online High Scores Solution

Can anybody advise solution for implementing online high scores table for iPhone game ? I mean simple engine to publish player result by http query and view global high scores table. I'm weak in PHP so trying to find existing solution first. Thanks. ...

PHP <<<EOB

I've been developing with PHP for some years now, and recently came across this code: <?php echo <<<EOB <html> <head> <title>My title</title> </head> ... EOB; ?> I've never seen this approach to print HTML, which seems to be pretty useful and less prone to some weird variable or double quote syntax error. I've...

PHP's json_encode does not escape all JSON control characters.

Is there any reasons why PHP's json_encode function does not escape all JSON control characters in a string? For example let's take a string which spans two rows and has control characters (\r \n " / \) in it: <?php $s = <<<END First row. Second row w/ "double quotes" and backslash: \. END; $s = json_encode($s); echo $s; // Will outpu...

Code for communcation between PHP and AS2?

I have a Flash developer I'm working with. This person is building a tool in AS2 that will provide an interface that will send voting data (firstname, lastname, email address, votes (there are 100 items in categories and users will be able to choose some subset to declare "best"). All fair enough, Flash dev will POST data to a PHP app I...

Inviting Friends and Sharing a report between them through Facebook api using php

Hi, I have made a facebook application which retrieves users friend list. Now i want to give the option of inviting friends through my application and the option of sharing reports between the invited friends through facebook api using php. How can i achieve this?Please help. ...

Ajax Security Question: JQuery ajax() + PHP scandir() = Security Issue??

I'm a beginner with PHP security issues. Someone reported a security issue with my code, but never gave details. Below is a condensed version of the code. I'm using the JQuery AJAX function to send some data to the server where it's used by the PHP scandir() function. Do you see any security issues? HTML Document <script src="h...

How to pick a color to make transparent in images?

First question, please be gentle ;-) I've written an image class that makes simple things (rectangles, text) a bit easier, basically a bunch of wrapper methods for PHP's image functions. What I'm trying to do now is to allow the user to define a selection, and have the following image operations only affect the selected area. I figured ...

Compressing a directory of files with PHP

I am creating a php backup script that will dump everything from a database and save it to a file. I have been successful in doing that but now I need to take hundreds of images in a directory and compress them into one simple .tar.gz file. What is the best way to do this and how is it done? I have no idea where to start. Thanks in ad...

Manipulating arrays in php

Hello, I have an file uploading site, it has an option of uploading through urls, what i am trying to do is whenever a user uploads through url, i check my database if a file exists that was uploaded through same url it displays the download url directly instead of uploading it again. The data sent to uploading script is in array form ...

XML frameworks in PHP

In addition to this question: iPhone network performance, I would like to know if there are any (very) good XML parsing frameworks out there for PHP. PHP has great XML support already, but I wonder if it could be better (in terms of performance, memory usage, etc). ...

regex and $_GET

I'm making a little site for a friend, noobfriendly, so she can add pages easy. I think I'm just gonna include everything in index.php. So she can just drop a page in a folder named /pages/ and it's done. index.php if (preg_match('/[a-zA-Z]/', $_GET['page'])){ $page = 'pages/'.$_GET['page'].'.php'; if ($page) { include $page; } else ...

PHP error reporting on specific folders

is there a way to set *error_reporting(E_ALL);* for a specific directory rather than including it in each file? I'd like to turn on error reporting for my beta.mysite.com ...

preg_replace(), and the abbreviations that go with it?

I've recently been working with a simple Twitter API for PHP and came across this code to make @username be linked with twitter.com/username. Unfortunately this code creates it so @username links to http://twitter.com/@username, resulting in error. There are many parts to this code I do not understand, such as ^\v and others (seen belo...

How to select content type from HTTP Accept header in PHP

I'm trying to build a standard compliant website framework which serves XHTML 1.1 as application/xhtml+xml or HTML 4.01 as text/html depending on the browser support. Currently it just looks for "application/xhtml+xml" anywhere in the accept header, and uses that if it exists, but that's not flexible - text/html might have a higher score...

How do you center an image in a specified area, without resizing the image?

I want to center an image in an area, without resizing... I am using HTML. Example: I have an image <img src='img1.png' width='64' height='64'> - the image is actually 64x64. It displays perfectly. Now, I have another image <img src='img2.png' width='64' height='64'> however, the image is not as big as it should be, its 32x32 - what ...