chatyak Posted June 13, 2011 Share Posted June 13, 2011 I need to be able to send data via an API (to another server), every time a conversion/sale is made. Here is an example: "Your Server to Server Key is 3adfa886-415f-4e80-8b53-bddedf59c0ec To use the Server to Server Conversion API, make one HTTP GET request for every conversion. Adknowledge prefers to receive conversion data as conversions are processed. This allows Adknowledge's conversion processing and discounting systems to make decisions and store results in real time as soon as data is received. The URL for the API is: http://bidsystem.adknowledge.com/conversion_sts.php?key=3adfa886-415f-4e80-8b53-bddedf59c0ec&click_id=clickid&ip=ip" Now on my tracking program's conversion page, I added the following PHP code: <?php $adknowledge = $_GET['http://bidsystem.adknowledge.com/conversion_sts.php?key=3adfa886-415f-4e80-8b53-bddedf59c0ec&click_id=clickid&ip=ip']; ?> Will this successfully send the data through and count as a conversion? I am so lost it's not even funny. Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 13, 2011 Share Posted June 13, 2011 All that does is set a value. What you need to do is send a request to the URL (same as if a user typed it into their browser). Others may have a better solution, but one easy way to do this is with file_get_contents(). That function will call a page (as defined by the url you provide) and return the results. I would think that their service would return something that would be of value such as a success or failure code. So, if there is a failure you could re-queue the request for later or recheck your data for errors. $key = '3adfa886-415f-4e80-8b53-bddedf59c0ec'; $clickID = 'some value'; $ip = '123.123.123.123'; //Only an example $result = file_get_contents("http://bidsystem.adknowledge.com/conversion_sts.php?key={$key}&click_id={$clickID}&ip={$ip}"); Quote Link to comment Share on other sites More sharing options...
chatyak Posted June 13, 2011 Author Share Posted June 13, 2011 Thank you for the reply - I shall fix the code and see if that works. Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted June 13, 2011 Share Posted June 13, 2011 If they're available, you'll have more options and get more response info with http_get() and maybe http_parse_message() after. Quote Link to comment Share on other sites More sharing options...
chatyak Posted June 13, 2011 Author Share Posted June 13, 2011 So my code should be this?: <?php $key = '3adfa886-415f-4e80-8b53-bddedf59c0ec'; $clickID = 'some value'; $ip = '123.123.123.123'; //Only an example $result = http_get("http://bidsystem.adknowledge.com/conversion_sts.php?key={$key}&click_id={$clickID}&ip={$ip}"); ?> Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted June 13, 2011 Share Posted June 13, 2011 Should work, or file_get_contents() if you get an undefined function error. Quote Link to comment Share on other sites More sharing options...
chatyak Posted June 13, 2011 Author Share Posted June 13, 2011 I am waiting on verification from the tech support team - I can't verify anything on my end as of yet - I will let you both know though - thank you. Quote Link to comment 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.