php

How can I speed up CURL tasks?

I'm using CURL to fetch some data from user accounts. First it logs in and then redirect to another URL where the data resides. My stats showed that it took an average of 14 seconds to fetch some data spread over 5 pages. I would like to speed things up, my questions are: Is it possible to see how much each step takes? Do you know how ...

User welcome message in php

How do I create a user welcome message in php. So that the user who has been logged on will be able to see his username. I have this code, but it doesn't seem to work. <?php $con = mysql_connect("localhost","root","nitoryolai123$%^"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $co...

Calling methods or functions with Jquery

So I can call a php page using jquery $.ajax({ type: "GET", url: "refresh_news_image.php", data: "name=" + name, success: function(html) { alert(html) $('div.imageHolder').html(html); } }); However this getting a bit messy, I have a few .php files that only really preform very simple tas...

Get only new RSS entries with PHP Script ?

What im trying to do: Fetch X numbers of RSS Feeds from my Blogs and echo only new entries. My Problem is, how to know wich items are already parsed? Solution so far: Fetch the Feed every 5 hours, store all titles inside an Database table or flat file. Next run check if the title is already in database if not print it and save it insi...

New byte in php

I have code JAVA byte abyte1[] = new byte[k]; But php not have byte type. Its possible to convert this line to php? ...

Apache/PHP is determined to serve the wrong file

I have a page that is called with a url like http://testserver/path/to/foo/bar/ but apache is serving the wrong file altogether. /path/to/ is a real directory where all the code and .htaccess file is. foo/bar/ is supposed to redirect to foo_bar.php with a RewriteRule, but it never gets there. It's not a mod_rewrite issue as I have comme...

What is an ideal instance size on ec2 servers for a busy site, as in a portal

I want to know the ideal instance site for a portal, may it be a news portal or sports portal and is there a better hosting solution than ec2 for such a site ? ...

Facebook API - Get comments

Our business has a Facebook Fan Page. The fan page doesn't seem to generate any emails to us when updates are made to the page, whether someone adds a new status or someone comments on one of the statuses etc. Currently, we are running a very crude script to grab the content of the page and then use regular expressions to get the infor...

Not able to open a file in php

The code chokes at fopen(): <?php ini_set('display_errors',1); error_reporting(E_ALL); $fp = fopen("/path/to/file/some_file.txt","a") or die("can't open file"); fwrite($fp,"some text"); fclose($fp); ?> And the resulting web page says: "Warning: fopen(/path/to/file/some_file.txt) [function.fopen]: failed to open stream: Pe...

Facebook publishActivity: No error, but no activity published

Hi, implementing publishActivity in PHP using the REST API using this code: $activity = array( 'message' => '{*actor*} did something.', 'action_link' => array( 'text' => 'Play Travians', 'href' => WEBROOT ) ); $activity = $facebook->api_client->dashboard_publishActivity($activity); I get a 15-digit number ...

PHP to PDF - Use text from XML document to create PDF?

I have some xml files that contain text, which are displayed on my website. I want to extract the text from these xml files and convert them to a pdf document that users can download. how can I can extract this text from the xml documents? (libraries etc?) how can I use this text to create a pdf document? I am working in a PHP enviro...

How to get first and last occurence of an array of words in text using PHP?

$arr = array('superman','gossipgirl',...); $text = 'arbitary stuff here...'; What I want to do is find the first/last occurencing index of each word in $arr within $text,how to do it efficiently in PHP? ...

Keep username in username field when incorrect password (php)

How do many of the websites that have logins keep the username in the username field when the password is entered incorrectly. The form's action (it is on index.php) is another php file, which if the password is incorrect uses Header() to go back to the index and passes the error to it using GET. I could use GET to pass the username back...

How to send complex types from PHP SoapClient to ASP.NET SOAP server?

Hello I'm having problems sending arrays, structs and arrays of structs from PHP to an ASP.NET SOAP server... Anyone have a sollution for this? I've googled for days and any sollution worked for me. Perphaps I'm forgetting something... There are examples of my code: $client = new SoapClient($options); $pCriteria = new stdClass(); $pC...

method readUnsignedByte in PHP

how get UnsignedBytes in php? In java very easy: readUnsignedByte (Java) ...

to take values of checkbox in table attributes

i have a database patient with 3-4 tables n each table has about 8 attributes.... i have a table medical history which has attribute additional info ... under which i have 5 checkboxes.... all the values entered are taken up except the chekbox values..... plz help ...

Convert PHP code to C#

Is there a web site or tool that will convert a piece PHP code to C#? something similar to http://converter.telerik.com/ or http://www.developerfusion.com/tools/convert/csharp-to-vb/ ...

PHP and jquery restrict direct access

Is it possible to restrict direct access to PHP file if I use jquery .load function like this one: $(document).ready(function(){ $("#second").load("testip.php"); }); In this case I want to restrict direct access to file testip.php that will instert data in database. Can I do it using some PHP function that will compare visitors IP ad...

date_create_from_format equivalent for PHP 5.2 (or lower)

Hi all, I'm working with PHP 5.3 on my local machine and needed to parse a UK date format (dd/mm/yyyy). I found that strtotime didn't work with that date format, so I used date_create_from_format instead - which works great. Now, my problem is that my staging server is running PHP 5.2, and date_create_from_format doesn't work on that ...

How to form an optimal query to get high scores from a data base?

Hi, I'm using a MySQL database to store scores for my game. A very simplified version of the table would be (PlayerID - int) (Name - string) (Score - int) I'd like to form a query that would return me a set of say 10 results where the player of interest is in the middle of the table. Perhaps an example would make it more clear. I h...