This has doing my head in for a couple of days now. I am creating a listing website. The listings are coming from direct listing creation in our website (using database). And also, we get the listings from another website in the form of data feed.
First of all, has anyone done the same work? I wonder whether this even possible. Can we get the listings from both sources (direct listings from database and data-feed from another website) and show them all on a same page (page a for example)?
If YES, then how we can search for the listings results using one single search form? I assume get and post methods need to be used at the same time. Get because of the data-feed which we use as below
<form name="Search_Form" method="get" action="http://a.com/a/a.php" onsubmit="return checkForm()">
And post for the direct listings from database as below
<form method="post" action="a.php">
Any suggestions would be highly appreciated.
Thanks heaps
You can’t GET and POST at the same time, they’re two different HTTP methods. You’re either making a GET request or a POST request to a URL.
If you need to scrape data from an external data source, then that’s a GET. If a user is searching on your site then that’s usually a GET too (since if the query parameters are in the URL then that can be cached, scraped by search engines etc).
In your scenario, the server-side PHP script would do a GET request to the external data feed via say, cURL and save the results to a variable; you would also query your database in this script; and then finally filter the results using the values that the user submitted.
I’m not sure where POST comes into this, unless I’ve misunderstood your problem.