yhi Posted May 6, 2015 Share Posted May 6, 2015 i want to send a request to a website i mean i want a php script to open a website in background dont want user to see website & i dont want to use iframe or get_file content etc.. bcoz after 30-40 request server give me Error & i am trying curl any fast way to do it ??? i just want to open the website which user give me & also i want something to protect the script from posting same request again & again i already added captcha but still while my code is working on backgroung user didnt see it so they press submit button again & again i want so show something like working or loading image in website while the script is being execute Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/ Share on other sites More sharing options...
ginerjm Posted May 6, 2015 Share Posted May 6, 2015 You need to be more specific with your terms and with your writing of English. Have no idea what all you want to do. 1 - you can't open a "website" with the user not being able to see it. What's the point if the user can't see it? 2 - Any fast way to do WHAT? User Curl? Finish the project? 3 - How does this user "give you a website"? What do you mean? People will probably not respond to you until you make some kind of sense here. Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/#findComment-1510944 Share on other sites More sharing options...
yhi Posted May 6, 2015 Author Share Posted May 6, 2015 i have a page which is already programmed to do something actually i am using API of a website & i want fast method to send request to API & sorry about my bad english Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/#findComment-1510950 Share on other sites More sharing options...
ginerjm Posted May 6, 2015 Share Posted May 6, 2015 Still have no idea what you want Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/#findComment-1510971 Share on other sites More sharing options...
QuickOldCar Posted May 6, 2015 Share Posted May 6, 2015 The fastest and best way is using curl. If your host is too slow get a faster one. If the api is too slow use something else. Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/#findComment-1510977 Share on other sites More sharing options...
yhi Posted May 7, 2015 Author Share Posted May 7, 2015 Still have no idea what you want i am using API of a website which allow me to do some task i want to do that task as fast as possible but after 33 contenious server give me Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at admin@abc.com to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. so i want a fast script to submit data given by user & also want to prevent user from this error the only option i can think of is limiting user submit limit to 30 or to 33 to prevent user from the error any better suggestion ? i limiting is not a good solution Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/#findComment-1511069 Share on other sites More sharing options...
yhi Posted May 7, 2015 Author Share Posted May 7, 2015 The fastest and best way is using curl. If your host is too slow get a faster one. If the api is too slow use something else. i think my api script is slow & the website whose api m using cant handel alot of contentious request so i have to do something like sending first 30 request firstly & then after some gap maybe 2-5 second have to send another 30 request or something like that & while request id being send i have to slow user something like "loading........ " or something like that so they dont send same request again & again Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/#findComment-1511070 Share on other sites More sharing options...
QuickOldCar Posted May 7, 2015 Share Posted May 7, 2015 i think my api script is slow & the website whose api m using cant handel alot of contentious request Sure they can be limiting the amount of requests, could act like a ddos attack and take their server down. i limiting is not a good solution I certainly feel it is. First of all why are you doing 60+ api requests a single page load. Lower the amount per page and create yourself a pagination to get the next set of results their api Think about what you are doing, a person has to wait a long time and load piles of information they may never even look at. Not to mention your server has to do this each user visiting every page. You can cache the api results and then show your local data if exists first...otherwise connect to api for fresh data In circumstances like this where the api service has limits ,slow or even down times.....I cache the json responses Other possible ways would be to use a lazy loader with jquery/ajax loading content as a person scrolls the page. Ever see sites with more...more...more... Is others that click a button for more Yet is others that load as you scroll down the page. I will give yet another solution, don't use their api and instead use their feeds. Looks like they show 34 at a time. Create a feed parser to display latest data or make a feed aggregator. Keep hitting the feeds in a timely manner and store the data a database Now you can show as many as desire without going overboard and not have these issues. Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/#findComment-1511080 Share on other sites More sharing options...
yhi Posted May 7, 2015 Author Share Posted May 7, 2015 sorry but i cant use feed i have to use the API is there is any way to pause the task ? i mean suppose user send 100 request so can we code a script which will send first 30 request then after 5 second send another 30 then after 5 second another 30 & soo on .......... & script will work in background & while it is working user will get a loading image or a message "please wait" or something like that a person i know already did it but he lost his script & he dont have time to code again same thing so i know it is possible i tried to contact him but he is not comming online so he didnt saw my message Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/#findComment-1511088 Share on other sites More sharing options...
QuickOldCar Posted May 7, 2015 Share Posted May 7, 2015 In php using delay or sleep would hang the page until entire script completed. Possible in javascript and why said to use a lazy loader with jquery or combination javascript and ajax Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/#findComment-1511092 Share on other sites More sharing options...
yhi Posted May 8, 2015 Author Share Posted May 8, 2015 In php using delay or sleep would hang the page until entire script completed. Possible in javascript and why said to use a lazy loader with jquery or combination javascript and ajax i dont know jquery or javascript or ajax.... & ok i will search about delay or sleep & can you help me in showing loading image while the script is working ?? i want to clear everything from page just want to show a loading or please wait message until script complete its work Quote Link to comment https://forums.phpfreaks.com/topic/296110-how-to/#findComment-1511198 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.