![]() |
|
| Domain Name Sales | Domain Software | Calculate UK Domain Drop Dates | Domain Registration | NameDrive | Domain Parking | Subscribe to our Domains For Sale newsletter |
| | ||||||
| Home | Register | Rules | Membership Upgrade | Domains For Sale | Domain Name Escrow | Mark Forums Read | Domain Classified | Chat Room |
| Scripts and Coding PHP, MySQL, scripts |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #11 (permalink) |
| Junior Member |
Here is another version of the code which I have been using and this does the same output as the one underneath it. <form action='trial.php' method='GET'> <input type="text" name="search_term"/> <input type="submit" value="Find"/> </form> <?php // the if statement if there is nothing in the search box if(empty($_GET['search_term'])) { print "This must not be left blank!"; exit(0); } $search = $_GET['search_term']; //Url for imdb $url = file_get_contents("http://www.deanclatworthy.com/imdb/?q=".urlencode($search)); $data =($url); print $data; 2nd Version: <form action='trial.php' method='GET'> <input type="text" name="search_term"/> <input type="submit" value="Find"/> </form> <?php // the if statement if there is nothing in the search box if(empty($_GET['search_term'])) { print "This must not be left blank!"; exit(0); } $movie = $_GET['search_term']; $movie = ("http://www.deanclatworthy.com/imdb/?q="); $movie = explode(",". $movie); $string = '{ "title":"", "year":"", "imdburl":"", "country":"", "languages":"", "genres":"", "rating":"", "votes":"", "usascreens":"", "ukscreens":"" }'; $obj = json_decode($string); printf('<a href="%s" title="%s">%s (%d)</a>', $obj->imdburl, $obj->title, $obj->title, $obj->year); Any help would be much appreciated. |
| |
| | #12 (permalink) |
| Junior Member | Works
I have just fiddled around with the code and at the moment it creates a link when the movie is searched and when you press the link it redirects you to the imdb web page! I still need to add another api but at the moment it works. Thank you. |
| |
| | #13 (permalink) |
| Junior Member | Query
Hi, I just need to know exactly what this does: $obj = json_decode($url); printf('<a href="%s" title="%s">%s (%d)</a>', $obj->imdburl, $obj->title, $obj->title, $obj->year); I know that it decodes the json into a php format. It does work which is great but if I want to add more details about the movie e.g. country I add that field as $obj->country after $obj->year and nothing appears? |
| |
| | #14 (permalink) |
![]() |
You will need to add another place holder in the first argument to the printf query. %s is the place holder for a string.
__________________ Me: Blog | Company | Twitter Coming Soon: DaveDomains | DaveCatcher | FreeToReg.co.uk |
| |
| | #17 (permalink) | ||
![]() | Quote:
This is very basic and not very useful: Creating and Parsing JSON data with PHP If you can implement this class could be useful: Table Constructor (html table) - PHP Classes Quote:
| ||
| |
| | #18 (permalink) |
| Junior Member |
Hi, Thanks a lot. Here is the code that I am working with: $obj = json_decode($url); printf('<a href="%s" title="%s">%s (%d) %s %s</a>', $obj->imdburl, $obj->title, $obj->title, $obj->year, $obj->country, $obj->genres); I presume that I will need the new Table ('data.json', 'json-file'); |
| |
| | #19 (permalink) |
| Junior Member | More problems!
Hi, I have been trying to do this for ages now....here is the code I have got. $obj = json_decode($url); printf('%s (%d) %s %s %s', $obj->title, $obj->year, $obj->country, $obj->genres, $obj->rating); printf('<a href="%s"> %s'</a>, $obj->imdburl); I want to display the first printf without linking to the url, I want this information to be displayed in a table with html or php. With the 2nd printf I want a link called 'More Info' to take the user to the imdb page on the film that is searched. Originally I had: printf('<a href="%s" title="%s">%s (%d)</a>', $obj->imdburl, $obj->title, $obj->title, $obj->year); This made the whole content hperlinked and when pressed it took the user to the imdb site with info about the film searched. I probably haven't described it clearly but if anyone knows how to do this it would help a lot. Thanks. |
| |
| | #20 (permalink) |
![]() |
This wont be exactly right, but should put you on track! No more help from me after this, you'll learn the most by finding your own way! PHP Code:
__________________ Me: Blog | Company | Twitter Coming Soon: DaveDomains | DaveCatcher | FreeToReg.co.uk |
| |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Domain Name Community | Replies | Last Post |
| PHP include in a Smarty Template | admin | Scripts and Coding | 1 | 13-05-2008 06:37:26 AM |
| PHP variable help | purg | General Board | 4 | 04-03-2008 02:30:21 PM |
| Problem displaying Google Adsense. | miked | Website Design | 2 | 20-07-2007 04:24:01 PM |
