php5

Upload image using CURL + PHP via remote form

I have a few images that i need to upload using an online form. So far here's my code $info = array('test title','1234','virginia','@'.realpath('e:\wamp\www\1.jpg'),'@'.realpath('e:\wamp\www\2.jpg'),'@'.realpath('e:\wamp\www\3.jpg'),'@'.realpath('e:\wamp\www\4.jpg'),'test description'); $post->postAd($url, $info); The $info array is ...

Can I get an example please?

$starcraft = array( "drone" => array( "cost" => "6_0-", "gas" => "192", "minerals" => "33", "attack" => "123", ) "zealot" => array( "cost" => "5_0-", "gas" => "112", "minerals" => "21...

Writing direct to disk with php

I would like to create an upload script that doesn't fall under the php upload limit. There might be an occasion where I need to upload a 2GB, or larger file and I don't want to have to change the whole server execution to above 32MB. Is there a way to write direct to disk from php? What method might you propose someone would use to...

NAMESPACE_SEPARATOR constant

Hello, Having namespaces in PHP is great. Having '\' as namespace separator is a little bit ... awkward (but if there is someone who thinks that is cool & sexy, I am adding tag "rant" to this post. ;) . So, here goes the question: Are you using in your code NAMESPACE_SEPARATOR constant? As in code below: <?php if (!\defined('NAME...

Calling a method within Portlet when submitting form

I have a Portlet that contains a form. Now what I want to achieve is the following. 1) A Porlet containing a form is called within a page via <?php $this->widget('form'); ?> 2) The user fills in this form and clicks on submit "The submit button should be an ajax button" 3) When submit has been pressed the form should call a method wi...

PHP mysql_real_escape_string() returning `NULL`

I'm using PHP Version 5.1.6 and trying to escape a query string from my $_GET array. However my script is returning a NULL after it's escaped. It seems that mysql_escape_string() works fine, but it's deprecated, so I don't want to use it. Having checked over the phpinfo() the MySQL lib is all loaded fine from what I can see. Has anyone...

Installing ImageMagick extension with php/windows

Running PHP Version 5.2.5 on Windows Server 2003 with IIS. Have virtually an identical server where we were able to install ImageMagick with no issues. It's running exactly the same version of php. Used the following steps to install, but it just won't seem to work on this server. ImageMagick itself is installed but php won't load the e...

does PHP Version 5.3.2 work without <?php woth with <?

i have one complete website which was written in php4, now my hosting server is PHP Version 5.3.2, windows 2008 server and my site is not working, what i found is old site use following syntax <? but if i change it into <?php page start working. is there any way to solve this issue... PHP Version 5.3.2 work with <? any scri...

Improving HTML scrapper efficiency with pcntl_fork()

With the help from two previous questions, I now have a working HTML scrapper that feeds product information into a database. What I am now trying to do is improve efficiently by wrapping my brain around with getting my scrapper working with pcntl_fork. If I split my php5-cli script into 10 separate chunks, I improve total runtime by a...

PHP Captcha: What is a "private key" and "public key"?

What is the difference between private key and public key and how is it used? ...

Why might this work on my server but not my schools?

I created a captcha just now, and it works PERFECTLY on my own server. On the school's server, it doesn't generate an image. Why might this be? The difference in code is one line. Edit: Originally, it was working, but I deleted the directory by mistake and I do not know why did it suddenly work in the first place. Update: I var_dumped(...

Maven for PHP + PHPUnit version newer than 3.3.9 not working

I want to use Maven for PHP with PHPUnit but when I run my tests with "mvn test" I get this error: http://pastie.org/948377 This happens only when I use a version newer than 3.3.9 for PHPUnit. The tests work just fine with PHPUnit 3.3.9. Any idea? ...

mysqli insert problem

Hello i have this error: Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of elements in type definition string doesn't match number of bind variables in E:\wamp\www\classes\UserLogin.php on line 31 and i dont know what it is :/ here is my code function createUser($username, $password) { $mysql = connect(); if($st...

security token problem with ajax requests

when building apps I use a token to prevent attacks on the forms each time a form is rendered it gets a new ONE TIME security token that i include in the form as a hidden field. this token is also stored in the session. when the form is sent, the token is verified against the token in the session to make sure the form is legit. This w...

How do I convert a string the looks like a hex number to an actual hex number in php?

Hey everyone, I have a string that looks like this "7a" and I want to convert it to the hex number 7A. I have tried using pack and unpack but that is giving me the hex representation for each individual character. I'm out of ideas and don't know where to go from here. Thanks for the help! ...

mysqli insert into database

Hello all i have this script and i will not insert into the database and i get no errors :S, do you know what it is? function createUser($username, $password) { $mysql = connect(); if($stmt = $mysql->prepare('INSERT INTO users (username, password, alder, hood, fornavn, efternavn, city, ip, level, email) VALUES (?,?,?,?,?,?,?...

Get value from SimpleXMLElement Object

I have something like this: $url = "http://ws.geonames.org/findNearbyPostalCodes?country=pl&amp;placename="; $url .= rawurlencode($city[$i]); $xml = simplexml_load_file($url); echo $url."\n"; $cityCode[] = array( 'city' => $city[$i], 'lat' => $xml->code[0]->lat, 'lng' => $xml->code[0]->lng ); It suppose to download xml ...

How can I detect the domain that is parsing my RSS feed?

I've got a php rss feed. There's a lot of domains that are using my RSS feed for news. I'd like to be able to track which domains are using my rss feed. I tried using $_SERVER['http_referrer'] to no avail. Any ideas? ...

How to read large number of rows efficiently using Zend_Db?

Is there a simple :) and efficient way or reading very large number of rows sequentially using Zend_Db? Basically I need to process entire table, row by row. Table is large, primary key sequence is not guaranteed(i.e. not an autoincrement, but is UNSIGNED INT). What's the best way to approach this? Environment: PHP 5.2, Zend Framework...

PHP help with error

Hi, I am working on a Zend project and it has been well over 12 months since I touched Zend, I am getting an error on one of my functions, and I cannot work out why, I think it may be down to the site being originally built in an earlier version of PHP (5.2) and I am now running 5.3. The function looks like this, public function add...