Re: This is a total php newbie question [message #175635 is a reply to message #175629] |
Fri, 14 October 2011 08:27 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 10/14/2011 2:58 AM, justaguy wrote:
> Sorry, Jerry, you missed my question.
>
Hi justaguy,
[Please don't toppost]
> Send the form to PayPay is to interface with PayPal's API
> with the form's ACTION line.
That is not interfacing with the paypal-api.
That is just posting a form to paypal.
action="https://www.paypal.com/cgi-bin/webscr"
> And since it's an API, PayPal has a way to let the user click on
> "Return to bla bla".
You cannot be sure the payment is finished at this point.
To make things complicated Paypal has all kinds of statuses for the
payments, including "pending" and stuff.
SOmetimes they have to wait for some other bank to respond.
You simply don't use paypal like you intend to.
Better to use the IPN messaging of Paypal.
(IPN is an unreliable mess, but it gets the job done, sometimes. I just
filed another bugreport. They told me they will fix in an undisclosed
period of time. Sure...)
>
> In essence, the task will accomplish two things:
> A) link the user/buyer to PayPal to make a payment
> B) back to my site with a special URL that give the buyer the info
> including the software download link (but this link would expire in 24
> hours).
You won't know if the payment succeeded when they arrive back at your site.
>
> Absolutely no need whatsoever with a database for this, it would be
> totally overkill.
If a database is difficult/overkill in your book, I advise you to stay
away from the IPN-messaging I mentioned above.
Maybe your best solution is to contact Paypal and ask them if they have
some preconfigured system for you.
Good luck.
Erwin Moller
>
> Don
>
>> On Oct 13, 8:17 pm, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 10/13/2011 6:29 PM, justaguy wrote:
>>
>>
>>
>>> Hi,
>>
>>> I sort of touched php at a very beginner's level a while ago...
>>
>>> Here' what I intended to do with some php scripts.
>>> Business wise,
>>> b1: take the user to PayPal to make a payment.
>>
>> OK
>>
>>> b2. take the user back from PayPal to download a program.
>>
>> You can't "take the user back". All you can do is send them to a site.
>> Once they're gone, they're out of your control. It's up to PayPal to
>> send them back (which the user may or may not do).
>>
>>> Technically with php.
>>> Have a base php script that performs the following task:
>>> Send a form to PayPal
>>
>> Are you going to send them to PayPal or send a form to PayPal? The two
>> are entirely different.
>>
>>> The Action line is tricky...
>>
>>> Another php script addresses the PayPal's Return link.
>>> it does two things:
>>> a) create another php script on the fly.
>>
>> Don't even think of this.
>>
>>> In it, it embed a link with a parameter.
>>
>> No problem.
>>
>>> b) it expires in 24 hours (remove the current context of the php file
>>> or replace it with the following statement:
>>> "The link has expired. Please contact i...@knowledgenotebook.com for
>>> assistance."
>>
>> Easy enough to do even without creating a script on the fly. That's
>> what databases are good for.
>>
>>> Next.
>>
>>> 1) how to create a php file on the fly?
>>> With the content in the following 2)
>>
>> As I said before - don't even try. Use a database.
>>
>> <snip>
>>
>>> 2) How to set the link var, note var and display them
>>
>>> <?php
>>> $link = "http://bla.bla.bal/myProgram.exe";
>>
>> If you want people to subscribe to something, don't let them link to it
>> directly. Otherwise anyone will be able to download it just by knowing
>> the location. Rather, place the file outside of your website's document
>> root and serve it with PHP (after validating people's information).
>>
>>
>>
>>> $note = "Please go to the Knowledge NoteBook website's Download page
>>> for Installation Instructions,
>>
>>> $date1 = new DateTime("now");
>>> $date2 = new DateTime("tomorrow");
>>> $interval = date_diff($date1, $date2);
>>
>>> if ($interval)> 0
>>> {
>>> $link = "";
>>> $note = "Sorry, the link has expired. Please contact
>>> i...@knowledgenotebook.com for assistance.";
>>> }
>>
>>> <? print($link); ?>
>>> <? print($note); ?>
>>
>>> ?>
>>
>> Again, use a database.
>>
>>> 3) How to expire or change its content?
>>> Sort of, resolved.
>>
>> Once again, use a database.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|