sofaking Posted February 24, 2013 Share Posted February 24, 2013 I'm looking for a bit of help with a couple of lines of code. I want to call another URL and send the customers email address to my newsletter site sign-up.to I have been trying to add a curl function to the create_account.php file near the end of the email to store section I originally posted this in General Support before realising there was a PHP section of the forum Original Thread http://www.oscommerce.com/forums/topic/391281-looking-for-a-bit-of-php-code-create-account-to-send-customer-info-straight-to/#entry1663690 If curl isn't the way to go I'll happily take some suggestions Cheers Michael Link to comment Share on other sites More sharing options...
Guest Posted February 24, 2013 Share Posted February 24, 2013 // end of email to store owner $url = 'https://api.sign-up.to/capture.php?cid=123&hash=aaa&mode=add&pid=12345&email='.$email_address; // Get a file into an array. In this example we'll go through HTTP to get // the HTML source of a URL. $result = file($url); // Proccess $result // print $result values print_r($result); Link to comment Share on other sites More sharing options...
sofaking Posted February 24, 2013 Author Share Posted February 24, 2013 Thanks MVS I have the following // end of email to store owner $url = 'https://api.sign-up.to/capture.php?cid=123&hash=aaa&mode=add&pid=12345&email='.$email_address; // Get a file into an array. In this example we'll go through HTTP to get // the HTML source of a URL. $result = file($url); // Proccess $result // print $result values print_r($result); tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL')); } } $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL')); ?> This passes the customer to the create_account_success.php page, but does not send the email address over to the url. Is there something I am missing with the code? If i copy and paste the URL into the address bar it sends over the email address - so I know I have the URL properly written, but doesn't send it automatically from the customer setting up an account. Anymore help would be appreciated. Cheers, Michael. Link to comment Share on other sites More sharing options...
germ Posted February 24, 2013 Share Posted February 24, 2013 The customers email address isn't available at that point without querying it from the DB. Try changing this code: // end of email to store owner $url = 'https://api.sign-up.to/capture.php?cid=123&hash=aaa&mode=add&pid=12345&email='.$email_address To this: // query the customers email addy $email_query = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'"); $email = tep_db_fetch_array($email_query); // end of email to store owner $url = 'https://api.sign-up.to/capture.php?cid=123&hash=aaa&mode=add&pid=12345&email='.$email['customers_email_address']; If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
germ Posted February 25, 2013 Share Posted February 25, 2013 Forget the last post. I was in the wrong file. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.