Jump to content

Help with http_build_query


Lassie

Recommended Posts

I need to append some query strings to url's and am trying to use http_build_query.

I have the following  types of url to build where there are varaibles to append

 

 
I have tried the last one first with the following code but I get an error unknown location form the response.
Is this the right way to build query strings? 
 
 
$post_code=$_GET['post_code'];
$key="1234k";//not a real key
$outcode= "outcode";

$fields = array('area'=>$post_code,
'output_type=>$outcode,
'api_key=>$key);
$url = "http://api.zoopla.co.uk/api/v1/zed_index?" . http_build_query($fields, '', "&");
 
Link to comment
Share on other sites

It looks like that's being routed on the recipient end. So what you've got is the equivalent of www.crime-statistics.co.uk?postcode=EX23 9DZ. Although I'm not sure this will work properly with the space - I should think it should be url-encoded.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.