php

Checking visitors IP against a table of IPs. Some wildcards.

I have a script that loops through an array of IP's and checks the clients IP against them. //filter IP address list $ip = array(); $ip[] = '10.10.5.*'; $ip[] = '234.119.260.65'; $ip[] = '234.119.254.2'; function testIP($ip){ //testing that correct IP address used for($i=0, $cnt=count($ip); $i<$cnt; $i++) { $ipregex = preg_replace...

Flex Remoting problem with PHP as Back end.

My PHP Code returns always NO regardless there is a username and password. Flex/MXML code: <mx:RemoteObject id="zendAMF" destination="zend" showBusyCursor="true" source="test_class" > <mx:method name="doLogin" result="onSayHelloResult(event)"> <mx:arguments> <username> {username.text} </username> <pass...

$_POST Question in PHP

public function doLogin($username,$password) { I am getting the username and password as arguements and not using POST method in my form which is in flex, its using remote object. Now how shall i recieve it down in PHP without using the formal way. if (isset($_POST['username']) && isset($_POST['password'])) { $username=...

how do i copy/upload file from S3 to EC2 in PHP

Hi I am having a file on S3 Example: test-company/upload/abc.txt I want to upload this abc.txt to my EC2 in php Do anybody having any idea please share it with example.. Thnaks Magi ...

PHP SOAP Issue : Object reference not set to an instance of an object.

Hi all, I'm trying to build an interface to https://ws.farebuzz.com/FlightGateway.asmx?WSDL using php and SoapClient class. I managed to get over the authentication header but I'm stuck when I try to call a method .. I'm always getting : Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object ref...

How do I invite people from MSN, Yahoo into my application?

Hi, I need to add an invite users functionality to my social networking application so users can invite contacts from their hotmail or yahoo accounts. How do I do this and are there any free open source libraries that do this? ...

Posting to posterous.com through posterous api

Hi, I am using curl and i want to post through posterous api. I am using this method posterous.com/api/newpost My code is $url="userid" $posturl = "posterous.com/api/newpost"; $session = curl_init($posturl); $postVars = array( "site_id" => $url, "body"=>$message ); curl_setopt($session, CURLOPT_POST, true); curl_setopt($sess...

Passing an array to Javascript in COMET

I got a basic gist of what COMET does (the constant looping on server side, and printing out <script> tags way), so I am just fiddling with it. I can pass a simple string from PHP to Javascript that way, but what about PHP arrays? Is there anyway to pass a PHP array to Javascript (casting it to a JS array??) using this method?? ...

How to structure HTML form elements so they can be easily translated into a PHP object?

I am trying to figure out the best way to name my HTML form fields so that they can be easily parsed into a set of PHP opbjects. For example I have the following table of elements: (let's assume it is inside a form) <table> <tr id='payment0'> <td><input type='text' name='paymentType0'></td> <td><input type='text' name='paymen...

Multiple parameters in NSURL object

I would like to pass multiple parameters from the iphone sdk to a server-side php which interfaces with a mySQL database. i found some answers on how to do this, but i'm having a hard time figuring out how to include several parameters. what i have right now is - (IBAction)sendButtonPressed:(id)sender { NSString *urlstr = [[NSSt...

PHP Equivalent to Perl's URI::URL

I'm in the process of rewriting a Perl-based web crawler I wrote nearly 8 years ago in PHP. I used the quite handy URI::URL module in perl to do things like: $sourceUrl = '/blah.html'; $baseHost = 'http://www.example.com'; my $url = URI::URL->new($sourceUrl, $baseHost); return $url->abs; returns: 'http://www.example.com/blah.html' t...

Regular expression get info from string [PHP]

How do I fill an array like this: array('0' => 'blabla','1' => 'blabla2') from a string like this: '#blabla foobar #blabla2' using preg_match()? ...

curl_exec function causes server to drop the connection

Hi Everyone, I am having a strange issue with the following function that I have written. Briefly, this function connects to a URL and fetches the output by using curl functions. However, when I execute this function, I get a "server unexpectedly dropped the connection" message: /** * Connects to remote URL and posts parameters, retur...

adding a Route to the a Router in Zend Framework

I am using the mod-rewrite router. I am trying to add a Route to the router that will convert the following url: baseurl/category/aaa/mycontroller/myaction/param/value to be: Controller=mycontroller action=myaction --parameters-- category=aaa param=value I am using the following (not working) in my bootstrap, _front is the ...

how to identify web crawlers of google/yahoo/msn by PHP?

AFAIK, $_SERVER['REMOTE_HOST'] should end up with "google.com" or "yahoo.com". but is it the most ensuring method? any other way out? ...

Inconsistent Video Conversion

I have a script calling a command to run an ffmpeg conversion on an uploaded video. It works only at random times however. Sometimes the form will finish submitting and the ffmpeg process will be running; at other times, the ffmpeg command fails to run at all. Here is the command that I'm running in an exec() function: ffmpeg -i "uploa...

why isn't this php loop working?!

I have this code: $thisTime = gmmktime(0, 0, 0); for($i=0; $i<=95; $i++) { $perfTimeNumber = ($i+1); $perfTimestamp = $thisTime; $perfTime = date("H:i", $perfTimestamp); echo '<option value="'. $perfTimeNumber .'" selected="'.$sel.'">' .$pe...

PHP Sessions Expiring Unexpectedly

I'm at a loss here. I've got a specific group of users upstairs whose sessions seem to expire completely randomly. It's not just when they leave the site sitting for a while, it can expire while they're browsing around. For me and most of our users everything works just fine. It's not a browser issue, we've got people in FF and all I...

How to specify a dynamic default for a key in a router, Zend Framework

This question is linked to this one How can I set the default of the category part to be the category value in the request url? $Router=$this->_front->getRouter(); $CategoryRoute = new Zend_Controller_Router_Route('category/:category/:controller/:action/*', array( 'controller' => 'index', ...

Developing a robust PHP postback handler

I'm developing a php based CMS, and I'm currently re-writing it into a state that is usable for customers. (My first version was internal only; and a somewhat kludgy mess :P) In my first version, I had a function called HandlePostBack() which checked for the existance of a significant number of $_POST variables - the submit button from ...