Question: I'm trying to curl a page (server.php) and send it three variables in a header ($webServiceId $hash and $timestamp), shown below. How can I grab the two variables out of the header in server.php so I can process them and send a response? I've tried googling and searching here, but I can't seem to find out how.

```
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'server.php');
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: URL-Encoded-API-Key {$webServiceId},{$hash},{$timestamp}"));
$response = curl_exec($ch);
curl_close ($ch);
// dump response
print_r( $response );

```

If server.php echos the headers its recieved back through the response, the print\_r of $response yields:

```
HTTP/1.1 200 OK Date: Thu, 02 Aug 2012 22:18:59 GMT Server: LiteSpeed Connection: close X-Powered-By: PHP/5.3.14 Allow: GET

```

the Authorization: URL-Encoded-API-Key is't in there. Could I be setting up the curl header wrong?

Answer: 
The 'link' column must be defined as a primary or unique key in order for the 'Insert .. on duplicate key update' syntax to work properly. 

Execute a 'Describe TableName' statement to print out the description of the table and its keys.

---

Now that you've posted your table's schema, you can see that the table has only one key defined, a key for the id column. 

You could do this:

alter table drivers\_cat\_copy
add unique index link\_uniq\_index (link(1054));

however, it will not be very efficient. You should look at the first answer of this question for a better solution: [MySQL: How to alter varchar(255) UNIQUE column to UNIQUE Text NOT NULL?](https://stackoverflow.com/questions/4744617/mysql-how-to-alter-varchar255-unique-column-to-unique-text-not-null)
You could write a stored procedure 

proc\_insert\_or\_update(var1, var2, varN, link)

if link exists
 UPDATE query
ELSE
 INSERT query

<http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html>