Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get file names from HTTP header

Posted on 2014-01-06
5
Medium Priority
?
243 Views
Last Modified: 2014-01-07
I'm sure someone has done this.

What I need to do is be able to connect to 2 different MySql databases on the same site.  The php/html is going to be the same.  My partner want's to change the data in his side of the site.

It's set up to load different databases on different servers and this does work.

Is there a way that I can get the info from the header on the web browser and then determine what data base that I should open?
0
Comment
Question by:breeze351
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 39760341
If you mean "Can PHP detect which URL was used to access a common PHP script set?" The answer is yes.  Look in $_SERVER['HTTP_HOST']
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 39760481
Somehow I think in other way,  when you do http access on browser
and you have already known what url you want to type or go on browser.
 
There is a lot of $_SERVER variables you might need, please read this
http://www.php.net/manual/en/reserved.variables.server.php

Please tell us more detail of your question, so we could help you on exectly what you need.

Duncan
0
 

Author Comment

by:breeze351
ID: 39760561
I've read it the manual.  I can get the end of the url.  What it need to do is the the front of it.

IE:
http:\\langsystems.net\index.php

or

http:\\amy.langsystems.net\index.php

If I can get the line from the url, I can parse between the "http\\" and the first period  and get "amy" and then open the correct database.
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 39760587
Thanks for your reply and explain. glad to see you have solved your question.
 When or after I  click submit button for my first reply post, this post has already
closed and solved.  sorry I was late to answer your question. Hope help  you
in next time.

have a nice day

Duncan
0
 

Author Comment

by:breeze351
ID: 39763102
I haven't resolved this yet.

There is one web site with a sub under it:

"langsystems.net"

"amelia.langsystems.net"

I need to change the database name to "amelia".
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question