php

Sending xml using php

Hello, I have a xml file on my server. I have the following two questions. How to send this xml file using php to the clients browser ? The client would be making an ajax get request to the php script that sends the xml as a response. On the server side i use php simplexml functions to parse xml data. But, on the client end what would...

div layout format php

i am trying it get that div displaying 5 in a row and then start a new line and display more atm all that is happening is the are going under each other. CODE < div>Line1< br />Line2< br>Line3< /div> Thank you ...

PHP cURL script not working for logging in rentacoder.com

Hi, I'm writing a script to do some search on rentacoder.com and to get certain data, I need to login. I'm using PHP cURL library. While cURL works perfectly on other pages of this site (for example, to search or to fetch a coder / project page), I cannot make it work for login. It always returns me an error page saying - "UserId or Pas...

How can I submit a form to two different pages (not at same time)?

I need to submit a page to two pages depending on which button is triggering the submit. Both pages needs to be able to pick up the $_POST data being sent. This is what I have so far, but it's not working. <form name="user" action="" method="POST"> <textarea name="tname" id="tname"></textarea> <input type='button' value='Submit' ...

Wordpress > getting full path to my theme's images directory regardless of parent paths

I have a function whose purpose is to list the folders within the images directory of my wordpress theme. It works great when the user has installed wordpress in the root directory of the site. However, it fails if the user has installed wordpress in a folder under the root... $mydir = get_dirs($_SERVER['DOCUMENT_ROOT'].'/wp-content/the...

PHP - with require_once/include/require, the path is relative to what?

when on "index.php", I do require_once("/all_fns.php"). "all_fns.php" itself requires files with paths relative to all_fns.php (itself). My question is, should I write the paths on all_fns relative to all_fns.php or to index.php? This is all very confusing to me and wanted to get it straight. ...

please help me with the my OOP PHP doubt?

I have the foll prog class Person { var $name; function Person () { } } $fred = new Person; $fred->name = "Fred"; $barney =& new Person; $barney->name = "Barney"; echo $barney->name; echo $fred->name; both the echo statements give the right same output ie "Fred" and "Barney" so whats the use of giving & while declaring $barne...

How do odbc (or mysql) resources work in php?

When you run a query like so: $query = "SELECT * FROM table"; $result = odbc_exec($dbh, $query); while ($row = odbc_fetch_array($result)) { print_r($row); } Does the resource stored in $result point to data that exists on the server running php? Or is pointing to data in the database? Put another way, as the while loop does it's...

Separate calls to Db data in one foreach loop

OK I hope this isn't too specific. I have a database driven CMS that a coworker uses with many categories in it. Here's how it echoes some products we have now: $offers = get_offers('category1','none','compare'); foreach ($offers as $row) { $offername = $row['name']; $offerlogo = $row['logo']; $offera=$row['detailA']; ...

PHP ftp_connect does nothing

Hi, I've configured a couple of php codes that connects to my server with the use of ftp connect. It works perfectly when I'm testing it locally, it connects, it goes in, i can access stuff. BUT when I upload it online and try it there. The php code does nothing. It executes all lines before "ftp_connect" then from that line onwards, i...

Use php to save text box content to a page.

Im trying to build a extremely basic content management system. I want to do it all with php and was hoping it would be as simple as echoing content that was submitted in a text form. The problem is I need to save the echoed content to the page somehow (preferably without a database) and then have it replaced with new echoed content if ...

PHP fopen filename. Is it relative or absolute?

Hi I'm having problems with my paths and fopen with reference to my web server. I have a file saved in public/dan/new/apps/lovescopes/thisfile.php. thisfile.php will create a new file in public/internalServer/lovescopes/xml/2009/12 using fopen "x+". now my errors show in the line where fopen is: 1.) if i type in the path as relative ...

PDF Downloading not functioning properly

I am using the following code to download a PDF.... header('Content-Type: application/pdf'); header('Content-Disposition: attachment; filename="NewName.pdf"'); readfile($root_path.'/full-tile-book.pdf'); It's a 13 MB file and only downloads like 130k and of course can't be opened. How do I debug what the issue is here? My p...

PHP difference between error_reporting() and ini_set('error_reporting')?

When using error_reporting() or ini_set('error_reporting') in my scripts, are there any functionality differences between the two? Is one method preferred over the other? For what it's worth, I see many frameworks using error_reporting(), but both options appear to be set during runtime only, then reset back to their default in php.ini ...

Sending contents of an xml file as response using php

Hello, I wrote xml to a file using php, and then I sent the file data as a response to the client's browser. But, I'm getting the following error: XML Parsing Error: not well-formed Below, is my code. Any way to fix this? $file= fopen("result.xml", "w"); $_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; $_xml .="<friends>"; $timest...

How do I call a function from a dll from php on windows?

Hi ! I'm using xampp. I search and it looks like for php 4.x, there was an extension called php_w32api.dll which seems to have vanished for php 5.x. Nevertheless, it's still in the documentation on php.net but marked as experimental. Some suggested to use win32std in pecl instead, but that just wraps some function of the win32 api, bu...

call php script every minute

Hey, I want to call a php script every minute. My scriptruntime on my webserver is about 90 sec. I thought doing it with cronjobs but i have to pay for that service. Is there an other possibility? Thanks a lot. ...

php file_put_contents() to a specific id on a page

I'm using file_put_contents() to post text from a text field. I want to post the data to a specific part of the page. file_put_contents('filename.php /* #fooid */', $formData, FILE_APPEND); Is there a way to add an id to post to? Thanks in advance. ...

How can we maintain session variables between our CMS and a standalone script on the same server?

We have developed a stand-alone script on the same server as our Joomla 1.5 installation. We want to see if the user is logged into to Joomla before giving them access to the script. To do that, we want to cross reference the session_id from Joomla and then query the Joomla database to verify that the user is logged in. At this po...

PHP - Is "include_path" meant to contain files that are automatically included?

I'm looking for a way to include a bunch of files so that they're accessible on all pages (functions, classes). I read about "include_path" configuration in php.ini and decided to test it by placing a dummy function inside my "includes" directory. However, when I try to call it, there's a fatal error that says: "Call to undefined functio...