php

consecutive if's in PHP

Hi, I'm doing some validation now in PHP, and I'm running allot of conditional statements, for example: if ($this->email->isValid($email)) return false; if ($this->username->isValid($username)) return false; ect.. Is there a nice way to do this? Or do I just run ten If statements like the ones above? I can't use switch obviously,...

Generate Thumbnails with PHP for a wide range of file formats

Hi All I have had a client request on a upload facility for his clients, but after upload that a image thumbnail to be created. All normal images are ok but he his talking about .psd, .pdf, .eps, .ppt Having a good look around I think wih imagemagick & ghostscript will cater for most of these but I cant find a solution of PPT or EPS. ...

XML-RPC with PHP and GoDaddy? Confusion sets in.

Hey folks, I am attempting to work with XML-RPC via PHP on a GoDaddy server. This same server is hosting a Wordpress Blog that makes use of XML-RPC and is functioning, though that may be unrelated... Whenever I attempt to use any functions that are integrated into PHP for use with XML-RPC, I get an error (function list here: http://us...

Nokia HTTP_REFERER issue

We've developing mobile application using CodeIgniter PHP framework. App was tested on several hardware phones and emulators. Everything works fine everywhere - except Nokia S40 built-in browser. When browsing via thatbrowser, it reveals that $_SERVER['HTTP_REFERER'] is not set at all - even using straight PHP with no frameworks. Specif...

What do I do with this csv dataset I just downloaded from dbpedia?

I just downloaded this csv of infoboxes of wikipedia from dbpedia. However I have no idea how to use it :-S I want to import all this data into a database but am not so sure how to take it from here. I downloaded it from http://wiki.dbpedia.org/Downloads32#infoboxes I'm working in Php Just for the record - this csv file is around 1.8...

Filter internet based email addresses

How can I go about doing a client side validation for email addresses where the email address has to be a non-internet based one as much as possible. i.e yahoo, gmail and hundreds are not allowed. It doesn't have to be perfect but I just want to minimize all the obivious scenarios of such email addresses being valid. Currently I just us...

Facebook API without client authentication for public content

I'm developing a site for a client who already have the photos of his products on Facebook, and he wants the same albums to be replicated over his site. I was already using Facebook Connect, so I dropped a combination of photos.getAlbums and photos.get to dynamically make the galleries. So far so good, but then I realized that if there'...

twitter status message update through bot using php and twitter oauth

Hi, I have followed the steps defined in the following link for twitter oauth implementation. https://docs.google.com/View?docID=dcf2dzzs_2339fzbfsf4 Its working fine when i run through web browser but i want a user should be able to update status of twitter account through gmail chat i.e. he should only be authenticated once through ...

Detecting whether a user is behind a proxy

Hello all, I'm trying to figure out how I could detect whether people logging into my site are behind a proxy or not. I've read that you can detect a person's real IP address through embeddable objects (Flash and Java). However, I haven't been able to actually find any examples or source for this. I'm using PHP and I've read that loo...

Goal Seek functionality in PHP

I want to implement functionality in PHP similar to what is available as Goal Seek in Microsoft Excel. Is such a thing possible to implement in PHP? Here is the story in detail We are writing a Personal Loan Management application for a financial company. They are at present using Excel sheets to do all kind of load, EMI, etc. calcula...

Wikipedia integration issue - need to finally sort this out 101

Sorry guys, I've been running a mock asking questions on how to integrate wikipedia data into my application and frankly I don't think I've had any success on my end as I've been trying all the ideas and kinda giving up when I read a dead end or obstacle. I'll try to explain what exactly I am trying to do here. I have a simple directory...

PHP parse error when referencing a string

I have the following constant defined in my PHP script: define("MODULE_PATH", "D:\\modules\\"); Whenever I try and assign the constant to a variable or as a function argument, I get a PHP parse error (with no explanation). var $jim = MODULE_PATH; var $fh = fopen(MODULE_PATH . "module1.xml"); Both above lines throw the parse erro...

What is the best practice to count equal values in a database?

I have a fairly large mysql database and I would like to count all the equal values, to explain myself better: I have a country field which has several countries values (USA, UK, MEX, etc..) and I want to get the number of countries without duplicate (if I have 100 USA and 2 UK and 1000 MEX the result would be 3). The only way I could ...

Adding alt img tags to an existing php website

I am currently tring to add in alt img tags for an existing website running the interspire shopping cart platform, I have gotten pretty close I bleieve, but i cannot seem to get it right. Any help would be grealty appreciated. // Is there a thumbnail image we can show? $thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb(); $alttext = $GL...

PHP flock() - what's under the hood?

After wrestling with PHP source for a half an hour, I gave up. :P The question is - what system call does the PHP flock() function call boil down to on a Gentoo Linux system? I'm having some issues with it (like block-for-30-seconds-in-every-one-of-20-loop-iterations kind of issues) and I would like to know why that is so. ...

CakePHP Generate layout content as a string

I'm building a CakePHP site where users can press a button to "save this newsletter as HTML". It seemed like a good idea to use a combination of requestAction and a media view to serve up the content to them, so that they get the exact same content as the live app. The only downside is that requestAction uses an empty layout, so there ar...

Get file encoding

How can I figure out with PHP what file encoding a file has? ...

PHP passthrough slow

For various reasons, I need to play the intermediary between an HTTP Request and a file on disk. My approach has been to populate headers and then perform a readfile('/path/to/file.jpg'); Now, everything works fine, except that it returns even a medium sized image very slowly. Can anyone provide me with a more efficient way of streamin...

Is this the best way to make an API request using PHP CURL?

Hello all, I have a site that has a simple API which can be used via http. I wish to make use of the API and submit data about 1000-1500 times at one time. Here is their API: http://api.jum.name/ I have constructed the URL to make a submission but now I am wondering what is the best way to make these 1000-1500 API GET requests? Here is...

php soap client: wsdl vs. non-wsdl - which is faster?

I'm Using PHP 5 and the built-in SoapClient. This is really a question for the developers of PHP Soap support. The SoapClient gives you 2 choices: WSDL mode, which caches the WSDL file locally, and non-WSDL which requires you to build your own requests. Using the WSDL is obviously more convenient. But, I wonder how much processing th...