Jump to content

Header converting & to &

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
rsnider19

rsnider19

    Learning Programmer

  • Members
  • PipPipPip
  • 34 posts
I am doing some basic website scraping and I have the following snippet:

ob_start();

$str = "Location: http://www.example.com/?&id=001";

header($str);

ob_end_flush();

Obviously this is not the site I am going to, but as an example. So the script then goes to Example Web Page instead. I tried urlencode/urldecode, but neither worked. Any ideas?

#2
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
The url is wrong. If it's the first variable it does not require the "&" symbol. That is for something 'after' the first variable:

Location: http://www.example.com/?&id=001
Should be:
Location: http://www.example.com/?id=001
Example:
Location: http://www.example.c...iLove=BlaineSch