Hello and thank you for contacting JustAnswer, a paid expert support site. My name is XXXXX XXXXX X'X be glad to assist you with your issue.
Are you attempting to place this into a specific part of a page?
I want to be able to take the search results and show them on a different page yes. I have reviewed scraping techniques, but I am having some issues in getting the result I want. For example, my primary website is located on a different server that the search engine and database. So, without the use of an iframe I want to use a form to hit the search engine with a query and then the results are scraped and copied to a spot on my primary site.
I understand. I was able to use this last night:
<?phpecho file_get_contents('http://22.214.171.124:7777/pls/golf/extresults?lcompany=&lcity=Sacramento&lstate=& amp;lzip=&BR=&GC=&GS=&TY=&INV=&RE=&PA=&WK=&i_info=0&search=++Search++&scompany=on&saddress=on&sphone=on&uname=&pword=);?>
I know you said that you tried file_get_contents but that is working.
Let me upload
I received an error message unloading that
Should there be more code with it?
Nope, that is it. What is the error?
Here, see for yourself. This is the code you just game me put in a blank php file. http://powersportshub.co/scrape4.php
Do you have access to the server error logs?
I think so
If so, can you please provide the last few lines?
I have regular logs..like hits and such, but not error logs. Don't see them
Ohh, I made a typo. Try this:
<?phpecho file_get_contents('http://6 126.96.36.199:7777/pls/golf/extresults?lcompany=&lcity=Sacramento&lstate=&lzip=&BR=&GC=&GS=&TY=&INV=&RE=&PA=&WK=&i_info=0&search=++Search++&scompany=on&saddress=on&sphone=on&uname=&pword=');?>
Here is the new code. Check it out.
No error now..just blank page.
If you click Run in the top right, it should work.
There might be restrictions on your PHP install to prevent remote files
Okay, I see how that is working and I thank you for showing it to me working elsewhere.
phpfiddle is pretty nice for testing code and sharing.
What do I add to the remote "form" to have those results get scraped and display?
You mean the form that submits to this script?
Yes, I need to me able to have the form query and then send back results like that. Here is the form for example.
Here is the actual form. http://back9directory.com/search/advanced_search_small.html
Right now we have to iframe this form. Once this gets figured out it will give us more choices and power. Our search engine is old school :/
Its ok. Just looking at it now
Form looks ok. Just change the action to the new script.
So how would I write that?
I understand what you are saying.
But not sure the coding
See on the form code where it says this: <FORM NAME="find" ACTION="http://188.8.131.52:7777/pls/golf/golf.extresults">
You just need to change the ACTION value to the php script
So, if the script is located at http://184.108.40.206:7777/pls/golf/extresults
that is what you would use for ACTION
So it would read: <FORM NAME="find" ACTION="http://220.127.116.11:7777/pls/golf/extresults">
So how are variables of the search passed then? Sorry part is beyond my skill level. I had that first part done, just the server sucked :(.
No worries at all. Each field has a name option. Those fields, with their values are sent to the php script.
In the PHP script, you then get these variables with $_REQUEST['name']
Okay, so the way it goes now. 1) The form I showed you 2) The new action goes to the php script that querys the search engine and scrapes the results?
replacing the 'name' with the name from the form
So, the PHP script will need to be modified clightly
To allow for the form values to be used.
Can you assist with that?
Sure. Let me see what I can do.
Just what the form action should be and then what changes to the new php file.
The new PHP file might be a little hard to understand if you are trying to learn it
Well that is okay.
But if I can do a search from a form, hit that script and it scrapes and returns the correct results I will be happy. I would like to get your direct contact on here to so that if I have any other issues I can pay you to assist me.
No problem at all. You can bookmark my profile page and ask from there if you need anything else. My profile page is my name in the lower left.
If you run that, it will give you errors because you aren't submitting a form to it.
So what action do I had to the form?
lets say the php file is called searchresults
Would it just be the url of the php file?
okay let me set it up and see if that works, brb
by the way, I found a different server that allowed for the script to work
Okay, this part of the coding is working. Can the results be placed into a page that has CSS, images and stuff or will it just be a copy of the results page?
You would need to put that html code around the <?php and ?> tags
You can just put html code in that php file but outside the <? ?> tags
That is what I thought :)
Okay, I will hit you up if I need any more help (which I am sure I will).