how to submit jsf form with curl - php

I am new to Java and JSF,
I was looking for some way to send a query term to toysrus.co.uk
I have already worked on php curl and I can handle it at my own, and I have coded my function which sends query term...
My issue is I am unable to create the query term and and I cant find a way to create a url in which I can add my query parameter so that I can curl this page.....
can somebody guide me how I can create the search url for toysrus.co.uk
what I want is, I will add my parameter in URL and the curl script will send this request to the site and I will get the searched product...
I want something like
http://www.toysrus.co.uk/index.jsf?seach=MYTERM
this is just an example what I want...
can somebody help me create the search URL for the said web site? being totally new to JSF, I am unable to do it...
also, when I googled on JSF and tried searching for helping material, I found not enough stuff on JSF
thanks for help..

You should be able to search the site just by changing the search term in the URL query string.
I went to the main page and typed "seriously" into the search box. Here's the address it sent me to:
http://www.toysrus.co.uk/index.jsf?fh_eds=%3f&fh_view_size=10&fh_start_index=0&fh_location=%2f%2ftrus%2fen_GB%2fcategories%3C%7btrus_trus%7d%2fitemtype%3dproduct%2f%24s%3dseriously&media=web
See where the search term shows up there? You can change that to any other word and it will search for that. Want to search for multiple terms, or a phrase? Try typing them into the search box and see how they're encoded in the URL. You can probably also remove or change some of those other parameters if you experiment with it.

Related

Change my url so that it doesnt show my data but i have a GET method how can i do that without rewriting everything into a post method? PHP

So i started a Project and im new to php so i did a GET method so that i can fetch data from the url but now all my data shows up in the url and i want to change the url so that it doesnt show all my data because i dont want the user using the website to see the ID i have in my Database is there a way to do it or do i have to rewrite everything in a post method ? because im search alot and i didnt find anything usefull. if i have to rewrite it to post methode i would like some help thanks.
Sorry, my friend. There's no way around it, you'll just have to switch it to post

How to extract Google Search results redirect URLs using PHP

I need a way for PHP to extract the FIRST result's URL from google search results page but I need the Redirect URL.
The search query:
https://www.google.com/search?site=&source=hp&q=what%27s+new+in+windows+phone
I need this link:
https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CC0QFjAA&url=http%3A%2F%2Fwww.windowsphone.com%2Fen-us%2Fhow-to%2Fwp8%2Fbasics%2Fwhats-new-in-windows-phone&ei=KL03VeH-Icvfavz-gcAD&usg=AFQjCNEYZMSiSVQ-TKnKgbNNT5CY1o_1kw`
Not the actual link:
http://www.windowsphone.com/en-us/how-to/wp8/basics/whats-new-in-windows-phone
Can anyone suggest anything? I would think you need to use Curl to fetch the page and then use Dom to parse the HTML to give you the redirect url. Just don't know how to do this exactly. Any help would be appreciated.
I have researched quite a bit but have only found questions on how to get the normal URL.

Need help changing search results URL to something which can be bookmarked

I hope someone can help me with this.
Currently when someone does a search on my website, the page that is returned has the URL:
http://www.dublinjobs.ie/main/index.
(Let's call this "the search results URL").
If you scroll to the bottom of the page you will see the pagination URLs use the form
http://www.dublinjobs.ie/main/index/2/basic/php/0/relevance/all/0/0/20/0/0/0/0/0/0/0.
(Let's call this "the pagination URL").
Is there some way I can change my website so the search results URL has a similar format to the pagination URL?
I need to to fix this because currently the search results URL cannot be bookmarked or emailed to someone as it is unspecific.
I'm guessing the solution is some sort of internal URL rewrite but I am not sure how to do this.
Thank you for your assistance.
EDIT: I don't want to just use a GET instead of a POST as I want to be able to control the URL layout.
Even your pagination URL doesn't include search term. What you need is to include search keywords in the URL itself to make it unique which can be bookmarked or shared.
Most likely you're using method="POST" in your search form which needs to change to: method="GET".
Note that it will make your URL like:
http://www.dublinjobs.ie/main/index?search=keyword
OK. I have a dirty hack fix.
I am using a header redirect in my PHP code to send them to the URL I want after doing my processing.

google custom search

cant quite find the answer I need so hopefully you guys can help.
I am trying to develop ( with basic but growing knowledge!) a split search bar for a custom cake website.
basically I have one search bar in the header, and a drop down with whole site and cakes in it.
When the whole site is selected I want it to pass the search parameters to googel custom search and display on the page. when cakes is selected it triggers a custom php search I wrote to search for and display a single cake picture.
I am doing this at the moment with an if statement. so if type=cakes then ( run php () else put search terms through google custom search.
Now I have tried using the results only format for it, but it doesnt seem to render anything! I dont know how to pass my parameter to the results page. I tried setting the parameter to cakeref which is what i have specified previously.
Any help or explanations as to how google custom search works and integrates would be amazing.
Try this
$search_query = "Is+Wikipedia+IsGreat";
$amazon_url = "https://www.googleapis.com/customsearch/v1?key=3425lh43lkh52lk34jh5&cx=023470239740:kj2h3kl4hlk23&alt=atom&num=5&q='$search_query'";
$google_search = file_get_contents($amazon_url);
You need API Key and CX number for calling this API. And urlencoding to encode query parameters.
Try Curl also..
API Client Library is here
http://code.google.com/p/google-api-php-client/
http://code.google.com/p/google-api-php-client/source/browse/trunk/examples/customSearch/index.php
http://www.phpclasses.org/package/6301-PHP-Perform-searches-with-the-Google-Site-Search-API.html

PHP scripting to use search engine

I'm making a simple website with a form where a user enters a word and then I take that word and google it using a php script and displaying the results. How would I be able to do this? or where would I get a script to do this?
I'm fairly sure reusing their results as you want to do is against their Terms of Service.
Why not simply create a form that redirects to the Google result page? Here is a tutorial on how.
Linking to Google Search Results
You would look for Google Site Search - http://www.google.com/sitesearch/
First, as quick solution, you should redirect your users to Google's result page.
When your sript receives the search term, it may
change spaces to "+" sign,
append it to the following URL: http://www.google.com/search?q=site%3Aexample.com+ (change example.com to your domain),
redirect to it.
Example: http://www.google.com/search?site=&q=site%3Astackoverflow.com+banana

Categories