致命错误:语法错误,意外' \' (T_NS_SEPARATOR),期望变量(T_VARIABLE)或' $'

时间:2015-07-03 02:38:28

标签: php twitter-bootstrap zendesk

所以我试图用我公司网页上填写的表格创建一张带有zen desk的票。我是一家初创公司的实习生,我之前从未在php中编码,字面上只有java。我试图将填写在我们网页上的表单连接到我们的消息中的zen desk子域,但我真的没有得到逻辑。 这就是我所拥有的:     

                <?php 
                echo $this->Session->flash();
                ?>
                <form id="facebook-pass-signup" class="form-horizontal sign-up-form pk-form-validate" action="<?php echo $this->Html->url("/forms/post/");  
            define("ZDAPIKEY", "keeeeeeeeeeeeeeeeeeeeeeeeeeeeeeey");  
            define("ZDUSER", "me@example.com");  
            define("ZDURL", "https://myzdaccount.zendesk.com/api/v2");
            function curlWrap($url, $json)
            {
             $ch = curl_init();
               curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
               curl_setopt($ch, CURLOPT_MAXREDIRS, 10 );
               curl_setopt($ch, CURLOPT_URL, ZDURL.$url);
               curl_setopt($ch, CURLOPT_USERPWD, ZDUSER."/token:".ZDAPIKEY);
               curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
               curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
               curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
               curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
               curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
               curl_setopt($ch, CURLOPT_TIMEOUT, 10);
               $output = curl_exec($ch);
               curl_close($ch);
               $decoded = json_decode($output);
               return $decoded;
            }
        $arr = array(  
        "new\_req\_name" => $\_POST["req\_name"],  
        "new\_req\_email" => $\_POST["req\_email"],  
        "new\_tick\_group" => "20546933",  
        "new\_tick\_assignee" => "346228388",  
        "new\_tick\_subj" => $\_POST["subject"],  
        "new\_tick\_desc" => $\_POST["tick\_desc"]  
                    );

    $create = json\_encode(  
    array(  
    'ticket' => array(  
    'requester' => array(  
    'name' => $arr['new\_req\_name'],  
    'email' => $arr['new\_req\_email']  
                        ),  
    'group\_id' => $arr['new\_tick\_group'],  
    'assignee\_id' => $arr['new\_tick\_assignee'],  
    'subject' => $arr['new\_tick\_subj'],  
    'description' => $arr['new\_tick\_desc']  
                     )  
         ),  
    JSON\_FORCE\_OBJECT 
                    );

$data = curlWrap("/tickets.json", $create, "POST");  
var\_dump($data);
print $data->ticket->id;  
print "\n";
                  ?>" method="post"> 
              <input type="hidden" name="pk-subject" value="Facebook Pass Signup"/>
              <h2 class="center text-dark-blue"><?php echo __("Sign Up Today")?></h2>
              <p class="center"><?php echo __("Our team will follow up with you on your request.")?></p>
              <div class="form-group">
                <div class="col-sm-10 col-sm-offset-1">
                  <input id="name" name="z_name" placeholder="Name" class="form-control input-md pk-mandatory" required type="text">
                </div>
              </div>
              <div class="form-group">
                <div class="col-sm-10 col-sm-offset-1">
                  <input id="email" name="z_requester" placeholder="Email" class="form-control input-md pk-mandatory pk-valid-email" required type="text">
                </div>
              </div>
              <div class="form-group">
                <div class="col-sm-10 col-sm-offset-1">
                  <input id="company" name="z_company"  placeholder="Company" class="form-control input-md pk-mandatory" required type="text">
                </div>
              </div>
              <div class="form-group">
                <div class="col-sm-10 col-sm-offset-1">
                  <textarea id="message" name="z_description" class="form-control" placeholder="Let us know if you have any questions."></textarea>
                </div>
              </div>
              <div class="form-group">
                <div class="col-sm-10 col-sm-offset-1">
                  <?php 
                    $this->Captcha->render($captchaSettings);
                  ?>
                </div>
              </div>
              <div class="form-group">
                <div class="col-sm-offset-1 col-sm-10">
                  <button type="submit" class="btn btn-form-submit btn-block">Submit</button>
                </div>
              </div>
            </form>
        </div>

0 个答案:

没有答案