php

http_post_data adding extra characters in response

Hey Guys I am getting some extra characters like '5ae' and '45c' interspersed along with valid data when using http_post_data. The data I am sending is XML and so is the response. The response contains these weird characters thats making the XML invalid. If I use fsockopen I do not have this issue. Would really like some input on thi...

is it a good practice to use mysql_free_result($result)??

Hi, I am aware of that All associated result memory is automatically freed at the end of the script's execution. But would you recommend using it, if I am using a quite of lot of somewhat similar actions as below? $sql = "select * from products"; $result = mysql_query($sql); if($result && mysql_num_rows($result) > 0) { while($data =...

PHP OPML Parser

Kindly tell me how to make an opml parser.I have the code but it is not working for all generic opml files if (file_exists('test.opml')) { $xml =simplexml_load_file('test.opml'); } for($i=0;$i<=count($xml);$i++) { $array=array($xml->body->outline->outline[$i]); $key=(array_keys($array)); foreach ($array as $key) { echo "<...

Display amazon books/products with PHP

Hello Guys, What is the best way to display amazon books/products on a website with PHP? Thanks, steamboy ...

Taking the data mapper approach in Zend Framework

Let's assume the following tables setup for a Zend Framework app. user (id) groups (id) groups_users (id, user_id, group_id, join_date) I took the Data Mapper approach to models which basically gives me: Model_User, Model_UsersMapper, Model_DbTable_Users Model_Group, Model_GroupsMapper, Model_DbTable_Groups Model_GroupUser, Model_Gr...

How can I embed the result of a web page into another webpage on another website?

I would like to allow users to call my ruby on rails app as a service which returns a 'div' with html content in it, and embed that div into their app (which will not be a rails application). For example, assume someone has their own php website that has a header/footer template that gets rendered, and a content area of the page that ...

Delaying emails in PHP to avoid exceeding server limit

Okay, so here's my problem: I have a list of members on a website, and periodically one of the admins my site (who are not very web or tech savvy) will send a newsletter to the memberlist. My current memberlist is well over 800 individuals long. So, I wrote an email script that sends the email to the full memberlist, with the members l...

PHP omits a return.

Hi, when a carriage return follows a closing php tag, php doesn't print it. How can I change this? Thanks a lot ...

how can i recieve a file sent by an applet to the server by post method?

how can i receive a file sent by an applet to the server by an applet to the server by post method when on server i need a php file to receive it how can i do so? i tried this; <?php $img_data = $_POST['txt']; $fp = fopen('test.doc', 'w'); fwrite($fp, $img_data); fclose($fp); ?> ...

Is there a PHP function to pull out the string between two characters?

Is there a PHP function that grabs the string in between two characters. For example, I want to know what is between the percent and dollar symbol: %HERE$ What is the function for this? ...

How to make sql query dynamic?

Hello, I am using this pagination class and was looking for a way to make the sql query more dynamic instead of having it hardcoded. I have a 3 <li> elements that I want to be filter buttons, meaning when a user clicks on one of these elements I want It to send the id so I can use it in a sql query. So for the $sql = "select * from ex...

Documenting PHP, should I copy/paste if I extend a class?

I have a PHP class with a method. In the base class (it's more like a prototype, but I'm not using prototypes because we have to be backwards compatible), I document the parameters and description of the method. Now I extend that class. In this new method (the implementation) should I re-document the parameters and description, should I...

Zend: Why form elements are not rendered correctly in windows? It was working on ubuntu.

I was working with Zend on Ubuntu and it was working correctly. Now I moved to windows for same project. But now elements of my form are not rendered correctly and their code is appeared on brower's page like this: translate( $this->element->getElement("email")->getLabel() ) ?> Any idea that what is the problem? ...

jQuery .live fireing multiple times!

Greetings Guru's, This is a little hard to explain, but I'll give it a shot. I have a quick question regarding to the .live() function in JQuery. I'm going to simplify the example here. I have a page "index.php" that has a container "#display_files_container" which is populated with anchor links that are generated dynamically by a di...

Developing Mobile App (Iphone,Blackberry,Android) for an existing website

Hey Guys I have a website and am planning to develop a mobile version of it for the iphone, blackberry and android. My website is a social network built on PHP Zend framework. Now all these mobile apps are going to be having the same functionality like the website. I am little ignorant about this - but from a high level I understand t...

How to remove all non-alphanumeric and non-space characters from a string in PHP?

I want to remove all non-alphanumeric and space characters from a string. So I do want spaces to remain. What do I put for a space in the below function within the [ ] brackets: ereg_replace("[^A-Za-z0-9]", "", $title); In other words, what symbol represents space, I know \n represents a new line, is there any such symbol for a single...

Object Oriented PHP books

Hi, I've realised just how rusty my knowledge of PHP 5 and advanced PHP programming is after completing some questions for a test. I seriously need to read a book or something. Any recommendations for PHP 5 books? ...

php multidimensional arrays, memory management

i need a structure like this array(){ [0] => array(){ [0] => array(){ // this array will have 'n' values(n is large, like 2000) } [1] => array(){ // this array will have 'n' values(n is large, like 2000) } ...

login form using ajax, to submit without refreshing

I am using this tutorial to create a login form http://www.ryancoughlin.com/2008/11/04/use-jquery-to-submit-form/ It authenticates against w/ our ldap server. What I am having a problem with is the line success: function(){ $('form#submit').hide(function(){$('div.success').fadeIn();}); It runs success even though we don't even kno...

Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';'

Hi, I'm really confused as to why this is kicking up an error? $admin = substr($_SERVER['REQUEST_URI'], 0, 7); $account = substr($_SERVER['REQUEST_URI'], 0, 9); if($admin != '/admin/' || $account != '/account/') { } It is giving this error Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' Why is it doing this? T...