(hint: too many $). Also after that is resolved you will still have
another issue, unless I am seeing it wrong, because it looks like you
will be missing the ampersand before 'n=' in your query string as it
is written now.
Good luck,
Milton
On Feb 24, 7:52 pm, Patrick Hereford <pheref...@gmail.com> wrote:
> Hey everyone. Thanks for responding. Before I paste the full code, let me
> explain in more detail what I am trying to do.
>
> When someone signs up on my website, they have to have an account on another
> website. The website is give or take in this structurehttp://www.website.com/info.xml?r=value1&y=value2with regard to 2 values I
> am asking for. While the user is signing up on the website, the next phase
> of the sign up is entering value1 and value2. I connect to the outside
> website upon getting these 2 values, grab the xml, turn it into an array,
> and check it to make sure that certain portions of the array exist (X.Y). I
> am unsure of the $url because I am not entirely sure how to grab the values
> put in the form other than that way. Now that that is out of the way, here
> is the full code.
>
> Model class:
> <?php
> uses('Xml');
> /**
> * Valid Checker: Is Valid Checker
> *
> */
>
> class Thing extends AppModel
> {
> var $name = 'value2';
> var $useTable = 'things';
>
> var $validate = array(
> 'value2' => array(
> 'rule' => array('isValidThing'),
> 'message' => 'Your thing is not valid!'
> )
> );
> function isValidThing($value, $params = array())
> {
> $url = "http://www.website.com/info.xml?r=
> ".$this->$data[$this->$name]['value1']."n=".$this->$data[$this->$name]['value2'];
> $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1)
> Gecko/20061204 Firefox/2.0.0.1";
> $curl_thing = curl_init();
> curl_setopt($curl_thing, CURLOPT_URL, $url);
> curl_setopt($curl_thing, CURLOPT_HEADER, 0);
> curl_setopt($curl_thing, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($curl_thing, CURLOPT_USERAGENT, $agent);
> $curl_result = curl_exec($curl_thing);
> curl_close($curl_thing);
>
> $thingResponse = new Xml($curl_result);
> $thingResponse->toArray();
> $value = set::check($thingResponse, 'X.Y');
> }
> ?>
>
> On Tue, Feb 24, 2009 at 7:23 PM, Marcelo Andrade <mfandr...@gmail.com>wrote:
>
>
>
>
>
> > On Tue, Feb 24, 2009 at 7:59 PM, Patrick Hereford <pheref...@gmail.com>
> > wrote:
> > > Hey everyone. I am having some trouble with this model class. The error
> > it
> > > is giving me is the following:
> > > "Parse error: syntax error, unexpected ';', expecting T_FUNCTION" on the
> > > last line with the bracket.
> > > Any advice?
>
> > Welcome, man. For sure it's syntax error.
> > Double check carefully your code. Specially...
>
> > $this->$data[$this->$name]['value2'];
>
> > Is this really correct?
>
> > Best regards.
>
> > --
> > MARCELO DE F. ANDRADE (aka "eleKtron")
> > Belem, PA, Amazonia, Brazil
> > Linux User #221105
>
> --
> Patrick Hereford
> 475 Commonwealth Ave Apt. 506
> Boston, MA 02215
> MIT - Class of 2005
> BC MBA - Class of 2008
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment