Title: Calling outside PHP
Last modified: August 21, 2016

---

# Calling outside PHP

 *  Resolved [miowebdesigns](https://wordpress.org/support/users/miowebdesigns/)
 * (@miowebdesigns)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/calling-outside-php/)
 * I have created a site and on it we need to call a program that downloads vcards,
   one for each employee. That means I need to pass the id for that employee. I 
   am trying $_GET. I have tried a straight call passing the parm. I tried creating
   a page and passing the parm thru the page. Here is a link: [http://hsm.bothwip2013.com/attorneys](http://hsm.bothwip2013.com/attorneys).
   I have never attempted this before. Any ideas?
 * Samples of code attempted:
 * `<a href="/attorneys-vcard.php?id=<?php echo $id;?>" class="attyvcard" title="
   Download Vcard"><span class="displace">Vcard</span></a>`
 * or within the same PHP program
 * `<a href=\"http://hsm.bothwip2013.com/attorneys/?id=$attorney_id\" class=\"atty-
   vcard\" title=\"Download Vcard\">`
    and then:
 *     ```
       $id = addslashes(mysql_real_escape_string(strip_tags($_GET['id'])));
       	if ($id !='') {include "attorney-vcard.php";}
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [miowebdesigns](https://wordpress.org/support/users/miowebdesigns/)
 * (@miowebdesigns)
 * [11 years, 12 months ago](https://wordpress.org/support/topic/calling-outside-php/#post-4930992)
 * The closest thing I have found to a solution is this link on stack overflow: 
   [output-buffering-with-php-headers](http://stackoverflow.com/questions/19836159/output-buffering-with-php-headers)
 * He is doing the same thing I am trying to accomplish. When I implement his code
   I get this error: “BEGIN:VCARD VERSION:3.0 N:Stone;Kenneth;R.;;; FN:Kenneth R.
   Stone TITLE:Partner PHOTO;VALUE=URL;TYPE=JPG:[http://www.baileyglasser.com/images/attorney_photos/kstone.png](http://www.baileyglasser.com/images/attorney_photos/kstone.png)
   ORG:Hefner, Stark & Marois, LLP TEL;WORK;VOICE: TEL;WORK;FAX: EMAIL;TYPE=PREF;
   INTERNET:kstone@hsmlaw.com ADR;WORK;ENCODING=QUOTED-PRINTABLE:;;2150 River Plaza
   Drive=0D=0ASuite 450;Sacramento;CA;95833;United States; URL;TYPE=WORK:[http://www.baileyglasser.com](http://www.baileyglasser.com)
   END:VCARD Warning: Cannot modify header information – headers already sent by(
   output started at /var/www/hsm.bothwip2013.com/wp-includes/link-template.php:
   1640) in /var/www/hsm.bothwip2013.com/wp-content/themes/Featherchild/attorney-
   vcard.php on line 59 Warning: Cannot modify header information – headers already
   sent by (output started at /var/www/hsm.bothwip2013.com/wp-includes/link-template.
   php:1640) in /var/www/hsm.bothwip2013.com/wp-content/themes/Featherchild/attorney-
   vcard.php on line 60 “
 * Here is my code:
 *     ```
       <?php
       ob_start();
       require "code/dbconn.php";
   
       if ($attorney_id) {
   
       $query="SELECT a.*, l.* FROM attorneys AS a JOIN lawfirm AS l ON l.id = a.attorney_office WHERE attorney_id = $attorney_id";
   
       $result=mysql_query($query);
       $myrow = mysql_fetch_array($result);
   
       $seoname=$myrow["seo_title"];
       $first=$myrow["attorney_fname"];
       $middle=$myrow["attorney_mname"];
       $last=$myrow["attorney_lname"];
       $attorney_email=$myrow["attorney_email"];
       $attorney_office=$myrow["attorney_office"];
       $tel=preg_replace ('/^(\d+)\.(\d+)\.(\d+)$/', '($1) $2-$3', $myrow["attorney_tel"]);
       $fax=preg_replace ('/^(\d+)\.(\d+)\.(\d+)$/', '($1) $2-$3', $myrow["attorney_fax"]);
       $attorney_title=$myrow["attorney_title"];
       if ($middle) {
       $fullname = (isset ($middle)) ? "$first $middle $last" : "$first $last"; }
       if (!$middle) {
       $fullname = (isset ($middle)) ? "$first $last" : "$first $last"; }
       $filename = preg_replace ('/ +/', '_', $fullname);
       $filename = preg_replace ('/[^a-z_]+/i', '', $filename);
       $photo = $myrow["attorney_photo"];
       $path = "http://www.baileyglasser.com/images/attorney_photos/";
       $office = $myrow["office"];
       $address =$myrow["address"];
       $address2 =$myrow["address2"];
       $city =$myrow["city"];
       $state =$myrow["state"];
       $zip =$myrow["zip"];
       $country ="United States";
   
       $query1  =   "SELECT * FROM titles WHERE $attorney_title=title_id ";
       $result1 = mysql_query($query1);
       $myrow1 = mysql_fetch_array($result1);
       $title = $myrow1["title_name"];
   
       print <<<END
       BEGIN:VCARD
       VERSION:3.0
       N:$last;$first;$middle;;;
       FN:$fullname
       TITLE:$title
       PHOTO;VALUE=URL;TYPE=JPG:$path$photo
       ORG:$office
       TEL;WORK;VOICE:$tel
       TEL;WORK;FAX:$fax
       EMAIL;TYPE=PREF;INTERNET:$attorney_email
       ADR;WORK;ENCODING=QUOTED-PRINTABLE:;;$address=0D=0A$address2;$city;$state;$zip;$country;
       URL;TYPE=WORK:http://www.baileyglasser.com
       END:VCARD
       END;
   
       $output = ob_get_contents();
       header('Content-Type: text/x-vcard');
       header('Content-Disposition: attachment; filename=vCard_' . $filename . '.vcf');
       return $output;
       exit();
       }
       ?>
       ```
   
 * Thanks for any further assistance.
 *  Thread Starter [miowebdesigns](https://wordpress.org/support/users/miowebdesigns/)
 * (@miowebdesigns)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/calling-outside-php/#post-4931031)
 * No help so closing ticket.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Calling outside PHP’ is closed to new replies.

## Tags

 * [$_get](https://wordpress.org/support/topic-tag/_get/)

 * 2 replies
 * 1 participant
 * Last reply from: [miowebdesigns](https://wordpress.org/support/users/miowebdesigns/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/calling-outside-php/#post-4931031)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
