rahul_aryanab Posted August 7, 2012 Share Posted August 7, 2012 Hi, I am very new to PHP but stuck with an issue which is far too complex as confirmed by now. I have two questions: 1. I have a database with all the registration details for an user registered to my website. I have icons on my home page which are linked to other website's home page. Is this possible that when a user clicks on an icon (of say expedia.com), user first gets programmatically registered to Expedia and then home page appears after logging in the user. I don't want user intervention anywhere between clicking on the link and getting logged-in to Expedia. I understand that I need to have some kind of agreement with Expedia as well. I can get their agreement, no issues. But want to know, if this is possible or not. If yes, how should I proceed such that Expedia's code is least affected? 2. Second question is also similar but this time I have a google custom search embedded in my website whose search result displays result from Expedia. Now, I want when user clicks on this link (expedia from search result), similar thing should happen as explained in 1 above. Hoping to get a positive response. Rahul Quote Link to comment https://forums.phpfreaks.com/topic/266760-best-way-to-register-programmatically/ Share on other sites More sharing options...
scootstah Posted August 7, 2012 Share Posted August 7, 2012 1. Yes, it is possible. If you're going to make an agreement with Expedia, find out if they have an API available - that would make things easy. Otherwise, you'll probably need to use cURL. 2. I'm a little fuzzy on this one, can you elaborate? What do you want to happen when you click a result? Quote Link to comment https://forums.phpfreaks.com/topic/266760-best-way-to-register-programmatically/#findComment-1367449 Share on other sites More sharing options...
rahul_aryanab Posted August 7, 2012 Author Share Posted August 7, 2012 Thanks for your reply. 1. Actually, I don't want to gia via API. Can't I send an xml containing registration data or a SQL insert script containg registration data to expedia and they can insert these data into their registration table? I can include a separate file into Expedia's codebase which does this work of inserting data from registration xml or insert file. Do you think, this is feasible and easier too. 2. I want same thing to happen with google search result links. Say a user searches for a flight ticket availability in google custom search which is present in home page of my website and the first search result is that for Expedia. Now, when a user clicks on Expedia link, he must be logged in to Expedia after getting registered automatically. Can this happen? Rahul Quote Link to comment https://forums.phpfreaks.com/topic/266760-best-way-to-register-programmatically/#findComment-1367456 Share on other sites More sharing options...
rahul_aryanab Posted August 7, 2012 Author Share Posted August 7, 2012 Sorry to overlook your second option of using cURL. If I don't want to go into any agreement with Expedia, is cURL capable of solving my problem? Using cURL, is it possible to send data from my database to the database of Expedia's? Rahul Quote Link to comment https://forums.phpfreaks.com/topic/266760-best-way-to-register-programmatically/#findComment-1367458 Share on other sites More sharing options...
scootstah Posted August 7, 2012 Share Posted August 7, 2012 1. Actually, I don't want to gia via API. Can't I send an xml containing registration data or a SQL insert script containg registration data to expedia and they can insert these data into their registration table? I can include a separate file into Expedia's codebase which does this work of inserting data from registration xml or insert file. Do you think, this is feasible and easier too. So, you want to execute your own code on Expedia's servers? I don't think that's going to happen. And no, you can't just send them XML or SQL, then they have to parse it/execute it. 2. I want same thing to happen with google search result links. Say a user searches for a flight ticket availability in google custom search which is present in home page of my website and the first search result is that for Expedia. Now, when a user clicks on Expedia link, he must be logged in to Expedia after getting registered automatically. Can this happen? Probably, but the answer is basically the same as #1 - use an API (if Expedia has one), or cURL. Quote Link to comment https://forums.phpfreaks.com/topic/266760-best-way-to-register-programmatically/#findComment-1367461 Share on other sites More sharing options...
scootstah Posted August 7, 2012 Share Posted August 7, 2012 Using cURL, is it possible to send data from my database to the database of Expedia's? No. cURL is a library that is used to connect to different protocols, like HTTP(S), FTP, etc. In this case, you would use cURL to send the POST data to Expedia's registration form. Expedia's own code would then process the request. It would be like if you manually entered all the data into the form and pressed submit. Quote Link to comment https://forums.phpfreaks.com/topic/266760-best-way-to-register-programmatically/#findComment-1367462 Share on other sites More sharing options...
ignace Posted August 7, 2012 Share Posted August 7, 2012 Unless their forms are csrf protected. Then you will also have to retrieve the token first. @op you can register them but not log them in not even with curl. Login involves a cookie send back to tbe browser in this case curl is your browser so the user will never get this cookie. You need an api like oauth to do that. Quote Link to comment https://forums.phpfreaks.com/topic/266760-best-way-to-register-programmatically/#findComment-1367493 Share on other sites More sharing options...
scootstah Posted August 7, 2012 Share Posted August 7, 2012 Unless their forms are csrf protected. @op you can register them but not log them in not even with curl. Login involves a cookie send back to tbe browser in this case curl is your browser so the user will never get this cookie. You need an api like oauth to do that. CSRF protection shouldn't be a big deal, it will just be created for the cURL request - just like a normal browser request. Also, cURL can work with cookies. The user won't actually be logged in to the site, but an action that requires the user to be logged in should still work from cURL. Quote Link to comment https://forums.phpfreaks.com/topic/266760-best-way-to-register-programmatically/#findComment-1367494 Share on other sites More sharing options...
rahul_aryanab Posted August 7, 2012 Author Share Posted August 7, 2012 Thanks a lot Gurus . I have got my answers. Quote Link to comment https://forums.phpfreaks.com/topic/266760-best-way-to-register-programmatically/#findComment-1367534 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.