php

What is PHP function overloading for?

In languages like Java, overloading can be used in this way: void test($foo, $bar){} int test($foo){} Then if you called test() with 2 arguments e.g test($x, $y);, the first function would be called. If you passed only 1 argument e.g test($x);, the 2nd function would be called. From the manual it seems that php 5 does have overloadin...

Failed requests by length in my ApacheBench load test result

I have a website in PHP, Lighttpd. It uses also MySQL on Centos 5. I've tested my PHP with code below with Apache Bench (ab). It resulted in some errors (Failed Requests) indicating other length than normal. I'm absolutely sure that my PHP result should always have the same exact length. I've reviewed my Lighttpd and MySQL logs and error...

Why isn't -stringWithContentsOfURL returning my php echo?

My app accesses a simple php file on my server that does a simple echo "YES"; for testing purposes. I try to get the contents of the echo into an NSString object as below but my string is ALWAYS returning (null). Whats wrong? NSString *theString = [NSString stringWithContentsOfURL:aURLThatEchos]; NSLog(@"Value is: %@", theString); //...

HTTP_Request using cURL or Pear (PHP) on XML Page

Hello all, I am not well-versed in HTTP requests. How can I, using PHP, grab and parse the information from this XML page, using a GET HTTP Request? http://heywatch.com/encoded_video/1850189.xml Basically, this is a video that was encoded, and I am trying to pull some of the values from the recently encoded video. More specifical...

Can $_SERVER variables in PHP be changed by the user? If so how?

I need to use $_SERVER variables like SCRIPT_FILENAME for a mvc framework I'm writing. I'm wondering if a user can change things like that. Say the user requests index.php, can they fake the SCRIPT_FILENAME variable and rename it to something else that is being sent over? ...

How to load a html file using jquery???

I Have to load a html file using jquery. When i referred google, i got the snippet $("#feeds").load("feeds.html"); But I dont want to load the content of feed.html into feeds object. Instead I need to load that page entirely. How to load that page. Help me plz ...

When is it good to use Exceptions on PHP?

I've been developing big applications using try/catch to handle all the exceptions and errors; however, I've been trying to figure out: When is it correct to use a try/catch statement? Is there a good practice/rule for try/catchs? Currently I'm building a SEO library for my PHP Framework and I have a "small" function, and I asked mysel...

Is there an application that can convert PHP code to ASP.Net?

I'm tired. I have ~30 really messy PHP files in my project. Hearing people say that Asp.net is more structured , that it is better (I'm mostly relying on Jeff's advice @codinghorror here) and that it is possible to use asp.net without using bloated software from M$. I don't want to and will not convert the the work done upto now, by hand...

How to set the div content dynamically while each load?

Home.html I have a left menu in which when visitor menu is clicked, it will load visitor.html in the div named 'rightcont'. $(".rightcont").load("visitor.html"); Also when the students menu is clicked, it will load students.html on the div rightcont $(".rightcont").load("students.html"); But by default i loaded welcome.html in th...

how to avoid Multiple insertion of same records in mysql php

I am inserting a value in to the table using php-mysql its getting inserted correctly.The insertion file in php is called through the ajax request. My problem is in some of the firefox version the request is triggered twice at some times and the records are inserted 6times with same datas in the table..How to prevent such situation witho...

Simple regexp help please

Hi, I would need a simple regexp urgently for php preg_replace: Input: Quick brown :no: fox etc Output: Quick brown !|no|! fox etc :something: to !|something|! Thanks ...

printing values from object

How do I echo the value from the object? In the following example I expect 1105 service number to be printed after "case". $vbk->set('service_no','1105'); echo "case".$vbk->service_no; I need to use object for this purpose. ...

Show each date only once

All right, this must be an absolutely easy question, and I apologize for that. I also apologize if I simply failed in finding the right search terms to use to come to an answer on my own. I did try, but my lack of fluency in PHP kind of makes me suck at searching. I'm looking for a simple way to show each date only once within a foreac...

Onclick function that mails page url to admin

I need to create some kind of JS onclick that will run a php mail script that emails a page with broken content. Would it be best to run a normal javascript onclick that calls a php file which is hidden, grabs the referring url and emails it? I would also like a message confirming the click, then disable it. Is there anything like thi...

How does push email/chat work? Can it be implemented easily for small websites?

I am trying to understand how push services work. I believe push notifications are where the server 'pushes' a new item to the client, but I don't know how that works in practice. For example, how does a phone "know" that it has a new email to pick up if it doesn't manually check the server for a new message? Also, how can this be impl...

How to install php5 curl in mac osx snow leopard?

How can I install php5 curl module or any other php5 modules in mac osx snow leopard? In Ubuntu 9.04 I am using: sudo apt-get install php5-curl I already tried Googling but can't find some solution. ...

cached php webpage content

hi there i have a webpage with a PHP switch on which I choose what page to display. A lot of the content is static and i wish to know how can i cache webpage for anonymous users. can you help me with some ideas, links? many thanks ...

How can I display SEO friendly URLs using mod_rewrite?

Hi, I am not a PHP developer at heart and I have been asked to perform some SEO on an existing PHP website. The first thing I noticed was the ugly URLs so I want to get these to rewrite to something more informative. Here are all the possible patterns: /index.php?m=ModuleType&categoryID=id /index.php?m=ModuleType&categoryID=id&product...

Cumulative DQL with Doctrine

Hello Im having a hard time working out a proper DQL to generate cumulative sum. I can do it in plain SQL but when it comes to DQL i cant get hold of it. Here is how it looks in SQL: SELECT s.name, p.date_short, p.nettobuy, (select sum(pp.nettobuy) as sum from price pp where pp.stock_id = p.stock_id and p.broker_id = pp.brok...

Regarding WebTechnology concept in PHP

Hello to all, If i logged in the gmail,at the same time if i open orkut..it will automatically redirect to my orkut account.how can possible? I have to implement same concept with the 2 domanis (ex: www.abc.com,www.bbc.com) throgugh PHP. If i login into the www.abc.com, then if opened www.bbc.com in same browser ,it will takes to the ...