Jump to content

nz_mitch

Members
  • Posts

    24
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

nz_mitch's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi there We're trying to collect just the images from a website so we can show them as a gallery without the additional details on the standard page. The photos we need are the high res images which show up in a lightbox. The existing HTML looks like this: <div id="photoBrowse" class="photos"> <div class="photoLrge"> <a class="fancybox primary" rel="photos" style="background-image:url(http://photos.harcourts.co.nz/011/568/024-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg);" href="http://photos.harcourts.co.nz/011/568/023-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""> <img src="http://photos.harcourts.co.nz/011/568/024-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" /> </a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/544/027-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/567/950-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/567/942-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/567/982-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/567/999-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/567/990-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/567/974-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/568/007-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/544/035-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/568/015-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/544/003-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/544/019-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/568/031-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a><a class="fancybox hidden" rel="photos" href="http://photos.harcourts.co.nz/011/568/047-MJ3563-Eversleigh-Road-Takapuna-North-Shore-City-Auckland-New-Zealand.jpg" title=""></a> </div> I've tried do something like the following, but this is really beyond what I can figure out. Any help would be really appreciated: include('simple_html_dom.php'); $url = "http://www.harcourts.co.nz/Property/View/MJ3563/38a-Eversleigh-Road"; $dom = file_get_html($url); $testdiv = $dom->find('a.imageBrowse',0); // 0 for the first occurrence $testdiv_contents = $testdiv->innertext; echo '<pre>'; print_r($testdiv_contents); echo '</pre>'; I've also tried something like this, based on the code available here: function scraping_24() { // // get news block $url = "http://www.harcourts.co.nz/Property/View/MJ3563/38a-Eversleigh-Road"; $html = file_get_html('http://www.harcourts.co.nz/Property/View/MJ3563/38a-Eversleigh-Road'); foreach($html->find('div.photoLrge') as $article) { // get image $item['photo'] = trim($article->find('a.fancybox', 0)->plaintext); $ret[] = $item; } // clean up memory $html->clear(); unset($html); return $ret; } I've tried to make sense of the PHP guide on DOM... I'm really sorry that I'm asking for help for something I have so little understanding of, but I've been at this for hours and I just can't crack it. Thanks Mitch
  2. Hi KrisNZ Thanks so much for your help! That was enough to get me going. Just needed a slight change which I'll include below in case anyone else stumbles upon this: foreach ($wuquery->form->Entries as $field_object) { echo $field_object->Field13.', '; } wuquery was what I was print_r'ing and the additional ->form was needed to drill down to the Field. Trying to figure out how to load it into a variable now :S Thought I could do something like this, but it doesn't play nice: function getEmail() { foreach ($wuquery->form->Entries as $field_object) { echo $field_object->Field13.', '; } } $to = getEmail(); mail($to,$subject,$message); [code=php:0] Nearly there though!
  3. Hi there I've been nutting away at this all day and haven't had any luck. Had a quick search around here and on Google but haven't been able to find a solution I can understand... it's all a bit beyond me. Any help would be much appreciated! I'm trying to get the email addresses out of the following object which I'm pulling down through the Wufoo Query API. I've got it outputting successfully like this when I do a print_r() stdClass Object ( [FormId] => 33 [Name] => Register Buyers App [Description] => [RedirectMessage] => Success! Thanks for filling out my form! [Redirect] => [url] => register-buyers-app [Email] => [styleId] => 10 [isPublic] => 1 [uniqueIP] => 0 [OffsetHeight] => 758 [ReplyTo] => 0 [ConfirmationFromAddress] => [ConfirmationSubject] => [ReceiptReplyTo] => [FromAddress] => [ReceiptMessage] => [ReceiptCopy] => [Language] => english [EmailNewEntries] => 0 [EmailNewComments] => 0 [PhoneNewEntries] => 0 [PhoneNewComments] => 0 [Mobile] => [Carrier] => [MerchantEnabled] => [LabelAlign] => topLabel [startDate] => 2000-01-01 12:00:00 [EndDate] => 2030-01-01 12:00:00 [EntryLimit] => 0 [PlainText] => 0 [useCaptcha] => 1 [DateCreated] => 2010-02-21 22:44:39 [DateUpdated] => 2010-02-23 15:10:34 [breadCrumbType] => 1 [showPageTitle] => 1 [showPageFooter] => 1 [PaymentPageTitle] => 0 [RulesEnabled] => 1 [NonCriticalIntegrations] => [EntryCount] => 2 [CurrentPage] => 1 [PageCount] => 1 [PageBreaks] => Array ( ) [Fields] => Array ( [0] => stdClass Object ( [FieldId] => 1004 [Title] => Buyer Name [instructions] => [Typeof] => text [size] => medium [isRequired] => 1 [isUnique] => 0 [isPrivate] => 0 [Validation] => 0 [Pos] => 0 [ColumnId] => 1 [FormId] => 33 [Price] => 0 [ClassNames] => leftHalf [isEncrypted] => 0 [RangeType] => character [RangeMin] => 0 [RangeMax] => [DefaultVal] => [ChoicesText] => 0 [settings] => Array ( [0] => ) [Page] => 1 [MerchantEnabled] => [doValidateRequired] => 1 ) [1] => stdClass Object ( [FieldId] => 1010 [Title] => Introduced On [instructions] => [Typeof] => eurodate [size] => medium [isRequired] => 1 [isUnique] => 0 [isPrivate] => 0 [Validation] => [Pos] => 1 [ColumnId] => 8 [FormId] => 33 [Price] => 0 [ClassNames] => rightHalf [isEncrypted] => 0 [RangeType] => character [RangeMin] => 0 [RangeMax] => 0 [DefaultVal] => [ChoicesText] => 0 [settings] => Array ( [0] => ) [Page] => 1 [MerchantEnabled] => [doValidateRequired] => 1 ) [2] => stdClass Object ( [FieldId] => 1005 [Title] => Buyer Feedback [instructions] => [Typeof] => textarea [size] => medium [isRequired] => 0 [isUnique] => 0 [isPrivate] => 0 [Validation] => 0 [Pos] => 2 [ColumnId] => 5 [FormId] => 33 [Price] => 0 [ClassNames] => [isEncrypted] => 0 [RangeType] => character [RangeMin] => 0 [RangeMax] => [DefaultVal] => [ChoicesText] => 0 [settings] => Array ( [0] => ) [Page] => 1 [MerchantEnabled] => [doValidateRequired] => 1 ) [3] => stdClass Object ( [FieldId] => 1006 [Title] => Agent [instructions] => [Typeof] => text [size] => medium [isRequired] => 0 [isUnique] => 0 [isPrivate] => 0 [Validation] => 0 [Pos] => 3 [ColumnId] => 2 [FormId] => 33 [Price] => 0 [ClassNames] => hide [isEncrypted] => 0 [RangeType] => character [RangeMin] => 0 [RangeMax] => [DefaultVal] => [ChoicesText] => 0 [settings] => Array ( [0] => ) [Page] => 1 [MerchantEnabled] => [doValidateRequired] => 1 ) [4] => stdClass Object ( [FieldId] => 1007 [Title] => Property [instructions] => [Typeof] => text [size] => medium [isRequired] => 0 [isUnique] => 0 [isPrivate] => 0 [Validation] => 0 [Pos] => 4 [ColumnId] => 3 [FormId] => 33 [Price] => 0 [ClassNames] => hide [isEncrypted] => 0 [RangeType] => character [RangeMin] => 0 [RangeMax] => [DefaultVal] => [ChoicesText] => 0 [settings] => Array ( [0] => ) [Page] => 1 [MerchantEnabled] => [doValidateRequired] => 1 ) [5] => stdClass Object ( [FieldId] => 1008 [Title] => Registering Agent Email [instructions] => [Typeof] => email [size] => medium [isRequired] => 0 [isUnique] => 0 [isPrivate] => 0 [Validation] => [Pos] => 5 [ColumnId] => 13 [FormId] => 33 [Price] => 0 [ClassNames] => [isEncrypted] => 0 [RangeType] => character [RangeMin] => 0 [RangeMax] => 0 [DefaultVal] => [ChoicesText] => 0 [settings] => Array ( [0] => ) [Page] => 1 [MerchantEnabled] => [doValidateRequired] => 1 ) [6] => stdClass Object ( [FieldId] => 1009 [Title] => Receiving Agent Email [instructions] => [Typeof] => email [size] => medium [isRequired] => 0 [isUnique] => 0 [isPrivate] => 0 [Validation] => 0 [Pos] => 6 [ColumnId] => 12 [FormId] => 33 [Price] => 0 [ClassNames] => hide [isEncrypted] => 0 [RangeType] => character [RangeMin] => 0 [RangeMax] => [DefaultVal] => [ChoicesText] => 0 [settings] => Array ( [0] => ) [Page] => 1 [MerchantEnabled] => [doValidateRequired] => 1 ) [7] => stdClass Object ( [Category] => Integration [Typeof] => Amazon [subFields] => Array ( [0] => stdClass Object ( [Typeof] => text [ColumnId] => HitId [ChoicesText] => MTurk HitId [DefaultVal] => 0 [Price] => 0 ) [1] => stdClass Object ( [Typeof] => text [ColumnId] => AssignmentId [ChoicesText] => MTurk AssignmentId [DefaultVal] => 0 [Price] => 0 ) [2] => stdClass Object ( [Typeof] => text [ColumnId] => Environment [ChoicesText] => MTurk Environment [DefaultVal] => 0 [Price] => 0 ) ) [isAltField] => 1 ) [8] => stdClass Object ( [Category] => Integration [Typeof] => Payments [subFields] => Array ( [0] => stdClass Object ( [Typeof] => text [ColumnId] => Status [ChoicesText] => Payment Status [DefaultVal] => 0 [Price] => 0 ) [1] => stdClass Object ( [Typeof] => text [ColumnId] => PurchaseTotal [ChoicesText] => Payment Total [DefaultVal] => 0 [Price] => 0 ) [2] => stdClass Object ( [Typeof] => text [ColumnId] => Currency [ChoicesText] => Payment Currency [DefaultVal] => 0 [Price] => 0 ) [3] => stdClass Object ( [Typeof] => text [ColumnId] => TransactionId [ChoicesText] => Payment Confirmation [DefaultVal] => 0 [Price] => 0 ) [4] => stdClass Object ( [Typeof] => text [ColumnId] => MerchantType [ChoicesText] => Payment Merchant [DefaultVal] => 0 [Price] => 0 ) ) [isAltField] => 1 ) [9] => stdClass Object ( [Category] => System [Typeof] => System [subFields] => Array ( [0] => stdClass Object ( [Typeof] => text [ColumnId] => EntryId [ChoicesText] => Entry Id [DefaultVal] => 0 [Price] => 0 ) [1] => stdClass Object ( [Typeof] => date [ColumnId] => DateCreated [ChoicesText] => Date Created [DefaultVal] => 0 [Price] => 0 ) [2] => stdClass Object ( [Typeof] => text [ColumnId] => CreatedBy [ChoicesText] => Created By [DefaultVal] => 0 [Price] => 0 ) [3] => stdClass Object ( [Typeof] => date [ColumnId] => DateUpdated [ChoicesText] => Last Updated [DefaultVal] => 0 [Price] => 0 ) [4] => stdClass Object ( [Typeof] => text [ColumnId] => UpdatedBy [ChoicesText] => Updated By [DefaultVal] => 0 [Price] => 0 ) ) [isAltField] => 1 ) [10] => stdClass Object ( [Category] => Integration [Typeof] => IPAddresses [subFields] => Array ( [0] => stdClass Object ( [Typeof] => text [ColumnId] => IP [ChoicesText] => IP Address [DefaultVal] => 0 [Price] => 0 ) [1] => stdClass Object ( [Typeof] => text [ColumnId] => LastPage [ChoicesText] => Last Page Accessed [DefaultVal] => 0 [Price] => 0 ) [2] => stdClass Object ( [Typeof] => text [ColumnId] => CompleteSubmission [ChoicesText] => Completion Status [DefaultVal] => 0 [Price] => 0 ) ) [isAltField] => 1 ) ) [EntryComments] => Array ( ) [integrationList] => Array ( ) [NoInstructions] => 1 [Entries] => Array ( [0] => stdClass Object ( [EntryId] => 24 [Field1] => Hurstmere Test [Field8] => 2010-10-10 [Field5] => [Field2] => admin [Field3] => 128 Hurstmere Road [Field13] => email1@domain.com [Field12] => email2@domain.com [HitId] => [AssignmentId] => [Environment] => [status] => [PurchaseTotal] => [Currency] => [TransactionId] => [MerchantType] => [DateCreated] => 2010-02-24 11:53:14 [CreatedBy] => public [DateUpdated] => [updatedBy] => [iP] => REDACTED [LastPage] => 1 [CompleteSubmission] => 1 ) [1] => stdClass Object ( [EntryId] => 25 [Field1] => Test Person [Field8] => 1111-11-11 [Field5] => [Field2] => admin [Field3] => 128 Hurstmere Road [Field13] => email1@domain.com [Field12] => email2@domain.com [HitId] => [AssignmentId] => [Environment] => [status] => [PurchaseTotal] => [Currency] => [TransactionId] => [MerchantType] => [DateCreated] => 2010-02-24 14:08:25 [CreatedBy] => public [DateUpdated] => [updatedBy] => [iP] => REDACTED [LastPage] => 1 [CompleteSubmission] => 1 ) ) I'm trying to get just the values from Field13 in the [Entries] array so I can feed them through to a simple email notifier using mail(). Could anyone help me get at them so I can turn them into a suitable string? Please let me know if my question doesn't make any sense or if you need any more information. Thanks so much in advance!
  4. Hi KingPhillip, Thanks for your help—that did it! Amateur mistake But now it's working perfect. Cheers
  5. Hi there, I've been trying for the last couple of hours to build some code that will change the number of items in a sidebar if they're specified using a custom field. Here's what I've got so far: <?php global $post; $custom_length = get_post_meta($post->ID, 'custom-sidebar-length', true); if ($custom_length=="") { $myposts = get_posts('numberposts=3'); // Change number of posts and category as you want } else { $myposts = get_posts('numberposts=$custom_length'); echo $custom_length; } foreach($myposts as $post) : ?> The echo $custom_length is only showing up when the custom length is specified and it's showing the right numbers—so I've got that part working. The issue is just in feeding it into the function get_posts. I'm guessing the way I've written the function [get_posts('numberposts=$custom_length');], doesn't allow the $custom_length value to be read properly. Is there a better way I can write this? Thanks in advance!
  6. I've been trying to figure out if there's a more efficient method to get the data out of the XML file (as I'm guessing that's where the slow down is) but haven't been able to make anything work. For reference, here's the XML file: − <params> <customParams sspWidth="635" sspHeight="428" navButtonStyle="Default"/> <nativeParams albumBackgroundAlpha="0" albumBackgroundColor="0x262626" albumDescColor="0xCCCCCC" albumDescSize="9" albumPadding="8" albumPreviewScale="Crop to Fit" albumPreviewSize="54,40" albumPreviewStrokeColor="0xFFFFFF" albumPreviewStrokeWeight="0" albumPreviewStyle="Inline Left" albumRolloverColor="0x262626" albumStrokeAppearance="Hidden" albumStrokeColor="0x141414" albumTextAlignment="Center" albumTitleColor="0xFFFFFF" albumTitleSize="10" audioAutoStart="Off" audioLoop="Off" audioPause="Off" audioVolume=".8" autoFinishMode="Switch" cacheContent="None" captionAppearance="Overlay Auto (If Available)" captionBackgroundAlpha=".75" captionBackgroundColor="0x000000" captionElements="Header and Caption" captionHeaderBackgroundAlpha=".8" captionPadding="5,5,5,5" captionPosition="Top" captionTextAlignment="Left" captionTextColor="0xEEEEEE" captionTextSize="9" contentAlign="Center" contentAreaAction="Launch Hyperlink" contentAreaBackgroundAlpha="0" contentAreaBackgroundColor="0x171622" contentAreaInteractivity="Action Area Only" contentAreaStrokeAppearance="Hidden" contentAreaStrokeColor="0x262626" contentFrameAlpha="1" contentFrameColor="0x262626" contentFramePadding="0" contentFrameStrokeAppearance="Hidden" contentFrameStrokeColor="0x333333" contentOrder="Sequential" contentScale="Crop to Fit All" contentScalePercent="1" directorLargePublishing="On" directorLargeQuality="80" directorLargeSharpening="1" directorThumbQuality="60" directorThumbSharpening="1" displayMode="Auto" feedbackBackgroundAlpha=".4" feedbackBackgroundColor="0x000000" feedbackHighlightAlpha=".8" feedbackHighlightColor="0xFFFFFF" feedbackPreloaderAlign="Center" feedbackPreloaderAppearance="Pie" feedbackPreloaderPosition="Inside Content Area" feedbackPreloaderTextSize="12" feedbackScale="1" feedbackTimerAlign="Top Right" feedbackTimerAppearance="Visible" feedbackTimerPosition="Inside Content Area" fullScreenReformat="On" fullScreenTakeOver="On" galleryAppearance="Visible" galleryBackgroundAlpha="0" galleryBackgroundColor="0x1c1c1c" galleryColumns="2" galleryOrder="Left to Right" galleryPadding="10" galleryRows="4" galleryNavActiveColor="0x303030" galleryNavAppearance="Hidden" galleryNavInactiveColor="0x000000" galleryNavRolloverColor="0x262626" galleryNavStrokeAppearance="Hidden" galleryNavStrokeColor="0x141414" galleryNavTextColor="0xCCCCCC" galleryNavTextSize="9" keyboardControl="On" mediaPlayerAppearance="Hidden" mediaPlayerBackgroundAlpha=".25" mediaPlayerBackgroundColor="0x000000" mediaPlayerBufferColor="0x000000" mediaPlayerControlColor="0xFFFFFF" mediaPlayerElapsedBackgroundColor="0xFFFFFF" mediaPlayerElapsedTextColor="0x000000" mediaPlayerPosition="Bottom" mediaPlayerProgressColor="0xCCCCCC" mediaPlayerScale=".8" mediaPlayerTextColor="0xEEEEEE" mediaPlayerTextSize="9" mediaPlayerVolumeBackgroundColor="0x000000" mediaPlayerVolumeHighlightColor="0xCCCCCC" navAppearance="Hidden" navBackgroundAlpha="1" navBackgroundColor="0x121212" navButtonsAppearance="All Visible" navButtonColor="0xEEEEEE" navGradientAlpha=".3" navGradientAppearance="Glass Dark" navLinkAppearance="Thumbnails" navLinkCurrentColor="0xEEEEEE" navLinkPreviewAppearance="Hidden" navLinkPreviewBackgroundAlpha="1" navLinkPreviewBackgroundColor="0xFFFFFF" navLinkPreviewScale="Proportional" navLinkPreviewSize="80,60" navLinkPreviewStrokeWeight="1" navLinkRolloverColor="0xFFFFFF" navLinkSpacing="10" navLinksBackgroundAlpha="1" navLinksBackgroundColor="0x121212" navNumberLinkColor="0x999999" navNumberLinkSize="9" navPosition="Bottom" navThumbLinkBackgroundColor="0x666666" navThumbLinkInactiveAlpha="1" navThumbLinkShadowAlpha=".6" navThumbLinkSize="20,20" navThumbLinkStrokeWeight="1" permalinks="Off" smoothing="Off" startup="Load Album" textStrings="Previous Screen,Next Screen,Screen,of,No caption,No title,Playing,Paused,Click play to start audio" toolAppearanceContentArea="Hidden" toolAppearanceNav="Visible" toolColor="0x222222" toolTextColor="0xEEEEEE" toolTextSize="9" toolDelayContentArea="0" toolDelayNav=".5" toolTimeoutContentArea="0" toolLabels="Gallery,Previous Group,Previous,Next,Next Group,Pause,Play,Full Screen,Normal Screen,Open Link" transitionDirection="Left to Right" transitionLength="2" transitionPause="4" transitionStyle="Blur" typeface="Lucida Grande,Lucida Sans Unicode,Verdana,Arial,_sans" typefaceHead="Lucida Grande,Lucida Sans Unicode,Verdana,Arial,_sans" typefaceEmbed="Off" videoAutoStart="On" videoBufferTime="5" xmlFilePath="http://domain.com/ssp-director/images.php?album=54" xmlFileType="Director"/> </params> You'll see it's the number "54" right at the end of the the XML file I'm after..
  7. Hi there, We're using SlideShowPro Director and the SSPD Connector for WordPress to pull galleries from Director into WordPress pages using the SSPD API. Anyhow, everything's working really well except the solution we came up with does not seem to have scaled well. The code we're using is the following (it's hooked into the WordPress template): $slideshow = get_post_meta($post->ID, 'slideshow', TRUE); $xml = simplexml_load_file("http://domain.com/wp-content/plugins/slidepress/tools/param.php?gid=$slideshow"); $url = $xml->nativeParams->attributes()->xmlFilePath; $id = ereg_replace('[^0-9]',"",$url); sspdc_photostrip($id,20); Essentially what the code does is it grabs the slideshow ID from a custom field in WordPress, then uses it to fetch the XML configuration file created by SlidePress (this file contains a number of variables, one of which is the ID for the Slideshow in SlideShowPro Director). The variable $url fetches the full URL to the slideshow in director (it too is an XML file). Next, with $id I'm using ereg_replace to strip everything from the URL except for the digits which make up the ID number which is required for the final function to call the gallery. Finally, the function sspdc_photostrip($id,20); builds the gallery, using $id to fetch the right gallery. If I comment out $slideshow, $xml $url and $id and insert the gallery number manually, the gallery builds super fast. If I just call $slideshow and parse that through the function, the gallery obvious does not load as the ID isn't recognised—but everything happens quickly, suggesting that the WordPress part is fine. Essentially, it looks like the issue is in the loading and parsing of the XML file (commenting out $id doesn't seem to make a difference). Can anyone recommend a more efficient way of doing this? As usual I'm at a bit of a loss—any help would be hugely appreciated. If there's any other information that might help, please let me know! Thanks in advance!
  8. Hi there, Finally got all the other issues at the other end resolved thanks to the helpful people here on this board and now I've just got to fix the form. The way I've had to structure things in the database I'm interacting with means that the API call I'm working with now outputs a more complicated array. Here's what it now looks like: Array ( [0] => Array ( [ListCustomField] => Array ( [0] => Array ( [FieldName] => ReferringAgent [Key] => [ReferringAgent] [DataType] => MultiSelectOne [FieldOptions] => Array ( [string] => Array ( [0] => REDACTED [1] => REDACTED [2] => REDACTED [3] => REDACTED ) ) ) [1] => Array ( [FieldName] => Referring Agent 1 [Key] => [ReferringAgent1] [DataType] => MultiSelectOne [FieldOptions] => Array ( [string] => JACK AND JANE ) ) [2] => Array ( [FieldName] => Signature Image [Key] => [signatureImage] [DataType] => MultiSelectOne [FieldOptions] => Array ( [string] => jackandjane ) ) ) ) ) I've tried all sorts of things to change and amend the following code provided by SemiApocalyptic, but whatever I do the drop down box doesn't get populated with anything. Here's the code from above which worked perfectly when there was a simple array with only one set of values: <?php echo "<select name='foo'>"; foreach($array['anyType']['ListCustomField']['FieldOptions']['string'] as $key => $value) { echo "<option value='$key'>$value</option>"; } echo "</select>"; ?> I now need to get the data from Array 1 (ReferringAgent1). There'll be more fields in that one obviously. Does anyone know how I can amend SemiApocalyptic's code so that it fetches that data and populates the drop down with it? Thanks so much!
  9. Thanks @lostnucleus! That almost worked, but when I changed it to $var['anyType'] it fixed it! So I needed === and 'anyType' Thanks so much everyone for your help!
  10. @taquitosensei Sorry don't quite follow what you mean there?
  11. Sure thing: /** * @return string A parsed response from the server, or null if something failed. * @see http://www.campaignmonitor.com/api/Subscribers.GetIsSubscribed.aspx */ function subscribersGetIsSubscribed( $email, $list_id = null ) { return $this->subscriberUnsubscribe( $email, $list_id, true ); } There's another API option, but it's really slow. Takes 5 - 10 seconds to check the database. The subscribersGetIsSubscribed seems to work very quickly, and is outputting TRUE / FALSE correctly when I print the values, so I'm guessing it should be able to work..
  12. print_r(array_values($var)); returns Array ( [0] => True ) (or False is the're not in the database). echo $var; returns Array ???
  13. Thanks for the quick response! I believe it's an array, yea. I tried with if ($var[0] == TRUE) and it always adds to the database, even when it shouldn't.
  14. Hi there, I've just about got a sign-up form working perfectly with the Campaign Monitor API. Had a trouble with it being too slow, but with help from people on this board and a bit of digging around I've finally got it super fast. Just having trouble with the right way to define the if is true statement. Here's what I've got: // Get info from form $name = $_POST["Field1"]; // Name $email_in = $_POST["Field2"]; // Raw email from form $email_out = strtolower($email_in); // Strip emails to lower case $ref = $_POST["Field109"]; // Referring Agent // Check if already subscribed, add if not, output error if is $var = $cm->subscribersGetIsSubscribed($email_out,$list_id); print_r(array_values($var)); if ($var['0'] == TRUE) { echo "Sorry, this email address is already in the database!"; echo '<br /><br />'; echo 'Click <a href="/" title="Add a New User">here</a> or use the back button in your browser to try a different subscriber.'; } else { // Add to Database with Custom Fields $result = $cm->subscriberAddWithCustomFields("$email_out","$name", array('ReferringAgent' => '$ref')); if($result['Result']['Code'] == 0) { echo "Success! You've added <strong>$name</strong> with the email address <strong>$email_out</strong> to the database."; echo "<br />$ref<br />"; echo 'Click <a href="/" title="Add a New User">here</a> or use the back button in your browser to try a different subscriber.'; } else { echo 'Error : ' . $result['Result']['Message']; }} This seems to be almost perfect. The print_r outputs True or False correctly - according to whether or not the email address is already subscribed. My problem is that I'm obviously not writing the conditional statement right. If I use: if ($var['0'] == TRUE) It always subscribes, even if the person is on the list. If I used: if ($var['anyType'] == TRUE) It never subscribes, even if the person is not on the list. As I mentioned, the print_r indicates the look up is working properly outputting the following if a user is already subscribed: Array ( [0] => True ) Or the following if they're not: Array ( [0] => False ) I'm sure I'm just doing something stupid with the conditional statement - can anyone put me right? Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.