php

How do I call and decode a JSON web service from PHP?

From within PHP, how can I call an external JSON web service and then decode the returned string? For example (pseudo-code): <?php $var jsonStr = json_decode("http://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&amp;sensor=false"); ?> ...

PHP Unserialize Offset Error

I have this code: $serialized = $_POST['cartSer']; echo $serialized; Which prints this: a:1:{s:15:\"test\";s:3:\"999\";} I then add this code: echo unserialize($serialized); And end up with this error: Notice: unserialize() [function.unserialize]: Error at offset 5 of 43 bytes in /mypage.php on line 5 What am I doing wrong ...

PHP + Javascript - Read/Write Cookies

Is it possible to create a cookie with javascript and then read it with PHP? And What about the other way around? ...

Dilemma, searching a hashed field when no other information is known

I'm having a dilemma. I have a field hashedX that is a hashed/salted value and the salt is saved in the same row in the mysql database as is common practice. hashedX saltX ------ ------ hashed1 ssai3 hashed2 woddp hashed3 92ofu When I receive inputX, I need to know if it matches any of the values in hashedX s...

MySQL - Specialized Order By?

Hello. Is there a way to specify a sorting procedure for ORDER BY, or some kind of custom logic? What I need is to check some other data for the column being ordered, which is also in the row. For example if one column has a higher value than another, but a certain condition isn't met, it's sorted as lower. Right now I pull all the dat...

facebook page referrer

I have set up my own Facebook page and would like to track analytics but use my own tools. Is it possible to track the referrer information? ...

Making a custom phpBMS form act like a normal HTML form

I am using a CMS like system, which defines custom form fields. To make a form, all you can really do is add certain form fields, and that is it. The only action possible within the CMS form builder is to save the form to the database. Here is an example of such a form. I want to basically have one field, the inputSmartSearch field, w...

Updating the contents of a dropdown list Javascript/PHP

I'm new to Javascript/Jquery and struggling with a certain issue. In the process of adding a job to a database, the users have an option to update the contents of dropdown lists with new options. Adding the new options is handled through a greybox which posts data with PHP through to the database. After adding the new option it doe...

Base10 to base64 url shortening

I'm coding an url shortener function for a project in which I'm learning php, here is the code (btw I suppose that global here is not a good thing to do :P): $alphabet = array(1 => "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z", "A","B","C","D","E","F","G","H","I",...

Storing and retrieving a date in PHP?

This is what I need to do: I need to perform a PHP operation, then retrieve how long ago the last time the operation was performed was. I have it all figured out, except one thing - how do I find the difference between two date/times? Or, is there an easier way to do this? (This is based in Wordpress, so I'm using wp_options to store the...

PHP: How do I get an attribute from a JSON array?

I have the following JSON array: <?php $json = { "status": "OK", "results": [ { "types": [ "street_address" ], "formatted_address": "5721 N Northcott Ave, Chicago, IL 60631, USA", "address_components": [ { "long_name": "5721", "short_name": "5721", "types": [ "street_number" ] }, { "long_n...

Pass a session from gwt into an iframe

Hi , I am working on a website built using GWT.Now i have an Iframe which actually opens up another website( for example say a Forum).Now all i want is a Single Sign On .That is once the user log's in into my system he is also automatically signed in into the forum and he can access the form with his username. Now the forum is actually ...

Send json object to mysql using jquery/javascript/php?

I have a page that generates json data from several fields and I want to send it to a mysql database. I currently have a link, the user clicks the link, the javascript takes the information they've inputed and sends it to a server. Due to the nature, I need all the data in one field in the mysql database. Any ideas? EDIT: The data comes...

generate HTML given a text file organized with carriage returns in PHP

sorry for the title... kind of lame... but anyways I'd like to be able to take in a file in PHP... **example_file.txt** United States Canada ----------------------- Albania Algeria American Samoa Andorra Angola and wrap these individual linebreaks in an HTML element that I pass it. EX: magicHtmlGenerator(example_file.txt, '<li>') ...

Generate Excel using php, format cells as string number etc

I am generating an excel file using php. The file gets created how ever strings with leading zeros example 0234 get converted to 234. ...

event management php mysql

hi , i am working on a event kind website. What i am trying to do is, i show a form for broadasters to create their events for the particular date and then store them in the database. when the event date is current date then users will be coming to the site will click on that event link to watch the show. when they click on that link i ...

PHP assigment operator =&

Possible Duplicate: Reference assignment operator in php =& What does the =& assigment operator mean in PHP? I could not find any reference in PHP Manual in assignment section. I saw it in a class instantiation, so I quite don't understand what's the difference between =& and solely =. Thanks in advance! ...

php based Business Instelligence system

I have a LAMP host, not tomcat therefore no java, I need a Business Intelligence Tool which can be run on mysql/php Must be able to download large reports ...

Symfony one-to-many embedrelation showing multiple forms

I'm having what should be a simple problem with Symfony. In this example I have a User, LookingFor, and LookingForNames table. The user table holds the user account and has a relation with LookingFor. The LookingFor table holds any relations between a user and the LookingForNames. Example: The user 'chain', could have two entries in...

How to escape new line from string

is there any php method to remove new line char from string? $str =" Hi there "; my string contains a new line char between 'Hi' and 'there' i want output as a "Hi there".I don't want to use regular expression. ...