php

PHP Using domdocument to extract data from html

I have a table with the following structure. I cannot seem to get the data I want. <table class="gsborder" cellspacing="0" cellpadding="2" rules="cols" border="1" id="d00"> <tr class="gridItem"> <td>Code</td><td>0adf</td> </tr><tr class="AltItem"> <td>CompanyName</td><td>Some Company</td> </tr><tr class="Item"> <td>Owner</td><t...

Simpler range finder?

Hay guys I've programmed a very simple range finder. The user can only select numbers 1 - 180 (axis) if the number is 90 or below i have to add 90 on to it if the number is 91 - 180 i have to take off 90 from it. Here's what i have $min_range = range(1,90); $max_range = range(91,180); if(in_array($axis, $min_range)){ $c = $axis...

[mysql] Auto Update query

Hello, I wanted to know whether i can direct update mysql datas to add (+) the values, without needing to fetch them. For example: My database is like this, data1 = 56 so to add a 4 to it, i will first fetch the data from the database then, $data1 = $data1 + 4; and finally again perform a Update query. So is there is way i can send l...

Find and replace in a file

i want to replace certain strings with another one in a text File( ex: \nH with ,H) .Is there any way to that using php? ...

Jquery Problem Loading Data from Form Into Ajax Driven PHP Page using Change

I am probably making some silly mistake but I am newer to the world of Jquery and am looking for some help with this issue. I have a form that I need to check/validate two dates once they change their values. Once they change I had an Ajax call that loaded a page "checkdates.php" and passed in two bits of data. The Date that changed ...

PHP mail() attachment is corrupt

I have been struggling with trying to send an email with an attachment using PHP. It used to work but the message body was scrambled. Now I have got the message body to work but the attachment corrupts. I used to use base64 encoding for the message body but now use 7bit. Can anyone tell me what I am doing wrong? PS please do not tell me...

decodeURIComponent for postgres

I use decodeURIComponent and encodeURIComponent in Javascript. Before I store this data in a UTF-8-PostgreSQL-Database, I should decode them: $my_data = pg_escape_string(utf8_encode($_POST['my_data'])); I'm looking for a PostgreSQL-Function to convert Javascript-Encoded Data. ...

Help with uploading images to EC2 instance (Flash -> PHP)

I have developed an image uploading application that uses Flash to load an image, resize the image and send the bytearray of the image data to a PHP file that outputs the resized file using the following code - $default_path = '/uploads/temp/'; $filename = $_GET["filename"]; $destination = $default_path . $filename; if(file_put_contents...

I'm using Simple HTML to grab data out of a table and need help.

Sorry for the poor title guys, but I'm whooped. I have a table as such: <table class="gsborder" cellspacing="0" cellpadding="2" rules="cols" border="1" id="d00"> <tr class="gridItem"> <td>Code</td><td>0adf</td> </tr><tr class="AltItem"> <td>CompanyName</td><td>Some Company</td> </t...

How to get the destination URL using cURL?

Hello How to get the destination URL using cURL? when the http status code is 302? <?PHP $url = "http://www.ecs.soton.ac.uk/news/"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $html = curl_exec($ch); $status_code = curl_getinfo($ch,...

Create View in Constructor class is right way

i m creating a view of a database in php smarty, i m confused where shoud i create that view , i just create view in a class's constructor function, now i have the problem that i m using function of that class through object of that class.... so is it true that each time that view is constructed??? example: cityview.php class city { ...

Improving soccer simulation algorithm

Hello! In another question, you helped me to build a simulation algorithm for soccer. I got some very good answers there. Thanks again! Now I've coded this algorithm. I would like to improve it and find little mistakes which could be in it. I don't want to discuss how to solve it - as we did in the last question. Now I only want to imp...

How do I pass a custom field to a hook (Invision Power Board [ipb] / PHP)

A long shot but here's hoping someone has some experience coding PHP hooks for Invisions Power Board forum. I'm attempting to code a status addition and the PHP works fine on it's own, it's the passing of the IPB's reference to my hook that is the issue. I.E. You setup a custom field in your forum for MSN Username, then from within a s...

What user is PHP on my CentOS linux box? root?

Hi I am trying to troubleshoot why I cannot get files to upload to my CentOS machine running on EC2 and think it may be a permissions problem (as I have gleamed from previous questions). How do I check what privileges my PHP installation has for writing files. The directory that I want to write files to has been created in the same folde...

SQL Statement many-to-many

I m trying to get construct a sql statement where many to many relationship occurs. Basically i want to retrieve business based on 2 categories some business are included in both categories and queried through zip code. So far i got the zip code part but it doesnt distinguish the category and i don't have a table for the categories also ...

Get current URL and trim with PHP

Im getting the URL using: $url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; This returns something like: http://me.domain.co.uk How can I select 'me' only? ...

Workaround for PHP SOAP request failure when wsdl defines service port binding as https and port 80?

I am consuming a SOAP web service using php5's soap extension. The service' wsdl was generated using Axis java2wsdl, and whatever options are used during generation result in the port binding url being listed as https://xxx.xxx.xxx.xxx**:80** If I download the wsdl to my server, remove the port 80 specification from the port binding lo...

Has anyone split db read and writes OSCommerce or any php shopping cart?

We are modifying osCommerce, but our architecture involves separate clusters for db reads and db writes. Has anyone separated these out? ...

Https POST from Php to C#

Hi, I have to make a post to a third party https url to get data procesed and sent back. And all I have as an example is this: $signature= foo_string; $data_to_post = json_dictionary; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $base_url); curl_setopt($ch, CURLOPT_USERPWD, "$user:$password"); curl_setopt($ch, CURLOPT_HTTPAUTH, CUR...

PDO acts different on two -very- similar queries

The following block of code works fine (no errors) $query = "select * from users where username = ?"; $statement = $sql->prepare($query); echo gettype($statement); // -- This returns 'object' $statement->bindParam(1, $username); The following gives: Fatal error: Call to a member function bindParam() on a non-object in /file.php on lin...