11

Been trying to figure out a way to pass in the variable into a HTTPGet function for long time now. How to do it? Here's what I have so far, but it doesn't return anything.

<p id="date" style="font-family:Georgia, serif; color:#446c5a; font-style:italic; font-size:16px; padding-top:0px; margin-bottom:0;">%%xtmonth%% %%xtday%%, %%xtyear%%</p>

%%[Var @curdate, @url

SET @curdate = Format(Now(), "MMddyyyy")
SET @url = Concat("http://theurltograbdatafrom.com/index.php?d=", @curdate)

HTTPGet(@url)
]%%

<p>%%=v(@url)=%%</p>

Have also tried the following:

<p id="date" style="font-family:Georgia, serif; color:#446c5a; font-style:italic; font-size:16px; padding-top:0px; margin-bottom:0;">%%xtmonth%% %%xtday%%, %%xtyear%%</p>

%%[Var @curdate, @url
SET @curdate = Format(Now(), "MMddyyyy")
SET @url = Concat("http://theurltograbdatafrom.com/index.php?d=", @curdate)
httpget; @url ]%%

<p>%%=v(@url)=%%</p>

Both examples return absolutely nothing! However the return value in <p>%%=v(@url)=%%</p> returns the proper URL, but how to use this url in either of these ways??

I am putting this code in a Content Area and than calling it from within an email that has that content retrieved into it.

  • 2
    Sorry, but how it is related to Salesforce? – Andrii Muzychuk Feb 13 '14 at 22:56
  • Where is the exact target support forum? I did a search on Exact Target Help and this came up as #1 on the list. – Solomon Closson Feb 13 '14 at 22:57
  • I would just ask this question in general stackexchange forum. – Andrii Muzychuk Feb 13 '14 at 23:00
  • 5
    @Chiz - I disagree with you. ExactTarget is a Salesforce platform and it is slowly being integrated into the marketing cloud. Might as well build up all of the knowledge around it now. – drakored Feb 13 '14 at 23:11
  • 4
    Last comment on the topic but just for future reference we had a bit of a discussion on meta around whether ET questions would 'fit' this site and the overall consensus was that they definitely would, so while the technologies don't have a lot of crossover right now ET questions are welcome. – Matt Lacey Feb 14 '14 at 2:52
7

Here ya go for everyone needing to know this. Here's how it is done:

<p id="date" style="font-family:Georgia, serif; color:#446c5a; font-style:italic; font-size:16px; padding-top:0px; margin-bottom:0;">%%xtmonth%% %%xtday%%, %%xtyear%%</p>

%%[Var @curdate, @url
SET @curdate = Format(Now(), "MMddyyyy")
SET @url = Concat("http://theurltograbdatafrom.com/index.php?d=", @curdate) ]%%

%%=HTTPGet(v(@url))=%%

Many Thanks go to drakored for the syntax help on this!

  • Ha, no problem. I was just about to post something similar for you to try out. Interesting syntax they have. This page should be helpful to anyone trying to learn this: help.exacttarget.com/en/documentation/exacttarget/content/… – drakored Feb 13 '14 at 23:45
  • I'm so happy that this is now working! I can relax now! I'm wondering if dd in the format string though will return 05 on the 5th day or if it just returns 5. I need to return 05, should it be changed to DD instead for this? – Solomon Closson Feb 13 '14 at 23:49
  • The docs I read said it's C# based. This page seems to indicate you'd be fine with dd as long as that page I read was correct that this is C# based. msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx – drakored Feb 14 '14 at 0:01
  • From ExactTarget docs: "S1 A C# compatible format string. Valid values include:" – drakored Feb 14 '14 at 0:02
  • 1
    Yeah, I tried with DD and that just put the letter in there. So guess I will be using dd instead, as my original way of doing it. – Solomon Closson Feb 14 '14 at 0:20
1

Adding to this answer. If you want to track links from the html you are pulling in, you will need to use a wrap function as well, as so:

%%[
set @var1 = "http://someurl.com"

var @getStatus, @content, @content2
set @content = HttpGET(treatascontent(@var1), false, 2, @getStatus)

set @content2 = Replace(treatascontentarea('TEST',@content),'http','httpgetwrap|http')

]%%

%%=TreatAsContent(@content2)=%%
1

You can also use the RedirectTo function to use the URL inside your html code.

<a href="%%=RedirectTo(@linkURL)=%%" target="_blank">
  • While this is great and all, this is a URL only. I needed to pull in an entire webpage based on a dynamic URL as content inside of the email. This is much different than pulling in the url into an email. But thanks for the addition to this just the same. – Solomon Closson Mar 17 '18 at 0:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.