php5

Import XML data via https

Hi , Is it possible to get/scrap data from https links using php, the https page ask for a user name and password and has data in XML format. so is it possible to get this data using PHP ? can anyone me suggest me the procedure ? ...

Facebook - getting permission for photos.get

Alright, I am developing a website that integrates with Facebook, and it retrieves photos of the users. The code to call it is $param = array( 'method' => 'photos.get', 'subj_id' => $fbme['id'], 'fields' => 'name', 'callback' => '' ); $photos = $facebook->api($param); However the problem is that this returns a bl...

save the list of sub directories in path

I want to point to a folder and then the php script should take the list of sub directories from that folder and save it into the database Can anyone provide a php script which would do the same thanks in advance $path = "new/cat1/"; want to get the list of sub-directories inside the $path folder and save those sub-directory names t...

How to display other sites content in our sites with out using iframe?

How to display other sites content in our sites with out using iframe? Is it possible to load one sites file details in our site with out using the iframe. any body knows the solution please help me with a sample code? ...

Which way is better to call a funtion static way or object way ?

Hi I'm new to OOPS, Can you guys suggest me which way is better to call a function of a class in PHP and why? the scenario is as follows. class A { function B (){} } Which method will take less resource to call the function B 1. A::B(); or 2. $obj = new A(); $obj->B(); ...

Passing multiple parameters to a method in PHP

Hello guys, I'm working on a simple class right now to get my head around OOP and i need some help with a function that i'm creating. The function receives various parameters, being some of those optional. For example: public function Test($req, $alsoreq, $notreq = null, $notreq2 = null, $notreq3 = null) { // blah blah } My ...

Object-oriented User login in PHP

Hello guys, I'm working on a object-oriented system and i would like to know what is the best way of handling a user login system, using sessions, under a OO model. Any good examples? Should i use autoloader? ...

Object-oriented MySQL query interface in PHP

I'm building a MySQL query "interface". It will allow me to make selects more easily. However, i'm having a doubt about passing empty parameters. Some of my function parameters are not required, so, i'm passing them empty. For example: query('table', '*', '', '', '0,10'); Being: query($table, $from, $where, $orderby, $limit) Is this...

How do I get curl to correctly identify mime type?

I'm using php to post an image along with some other data. Using the sample code from the php doc site (example 2 here: http://php.net/manual/en/function.curl-setopt.php, if I output what gets sent with my script ($_FILE) I see something like this: Array ( [file] => Array ( [name] => temp.gif [type] => application/o...

Call to a member function in PHP

I'm receiving the following error message while trying to call a method from a Singleton class, inside another class. Any ideas? Call to a member function query() on a non-object. ...

Is this a good way to remove Script, Onmouseover,onerror and onload with php

I am doing this. It seems to work but is it best way? Like could people still post XSS code or should this catch it all? $pattern[0] = '/script/'; $pattern[1] = '/onmouseover/'; $pattern[2] = '/onerror/'; $pattern[3] = '/onload/'; $replacement[0] = 'scr<b></b>ipt'; $replacement[1] = 'onmouse<b></b>over'; $replacement[2] = 'on<b></b>...

PHP, SimpleXML arrays. Unanticipated casting of an array to a string

Sample XML: <root> <ratings>3</ratings> <ratings>5</ratings> <ratings>7</ratings> </root> The following code is the basis for my small application, it works as would be expected: <?php // $xml is some simplexml object sizeof($xml->ratings); //3 foreach($xml->ratings as $rating){ echo($rating->value."::"); //thi...

how to run sql query after image upload in php when i am using flash uploader for multiple file uploading

Hi , I am using library to upload multiple images in php .This library use flash file and a php file . All things are working but problem is that I want to run a query after each image is uploaded to store image detail in database . If i write query in php file after uploading code then It upload images but no error given and no image d...

Noob PHP/MongoDB Question

I am trying to create a function that checks to see if a user name already exists. I am still trying to get my head wrapped around MongoDB and was wonder what is the best way to approach this? I was going to do some the following (in Code Igniter): $filter = array ('userName' => $value); $exists = $md->find($filter); if ($exist) { ...

LAMP and memory/swap space problem

My LAMP application seems to eventually use up all of my server's memory and swap space. My gut feeling is that it has something to do with the external processes I have to call (as that is the only time the problem manifests). I need to call GhostScript, ImageMagick's "convert", PDFTK, etc. constantly. When those processes are running,...

How does mediawiki upload files to server

Hi all, I just found out that mediawiki does not use move_uploaded_file. So how does mediawiki upload file to the database. I looked at the source code but could not understand much. Kind of urgent. Any Help is appreciated! ...

cannot use cookies in cURL PHP

I'm using cURL to parse a website. http://www.hcmiu.edu.vn/bookforsale/showbooks.php It need session to view, if you don't have session then the page redirect to : http://www.hcmiu.edu.vn/bookforsale/perInfo.php I use this code to get session cookie but I don't know why I cannot see any change to file cookies.txt $urltopost...

Remove domain extension

So let's say I have just-a.domain.com,just-a-domain.info,just.a-domain.net how can I remove the extension .com,.net.info ... and I need the resultes in two variables one with the domain name and another one with the extension. I tried with str_replace but doesn't work, I guess only with regex....where I'm a noob. Can someone please hel...

Single Sign Out accross multiple domains

Hi, I know there are very similar questions and answers posted. And I have used them for reference, but I would like to throw a specific case out there. A way to implement Single Sign Out / Single Log Out across multiple domains. From what I read it looks like the only way is using a server to server service, ie. tracking users by verif...

does my free php Web-hosting will support wordpress website.

Hi all. I have create account with free account with web-hosting company which are giving me 1000 MB disk space plus 2 mysql database. Can any body tell me that I can upload my wordpress site to this free hosting plan. I am very new to Web development Thanks. ...