Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6188723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:17:08+00:00 2026-05-24T02:17:08+00:00

I’m trying to connect to a sql db through php but it seems that

  • 0

I’m trying to connect to a sql db through php but it seems that my hosting provider has blocked access to connect to remote db’s so I’ve been told to use http and “parse a key” to my other hosting account (with a different hosting provider) and run the mysql queries from there and then send the data back to the original.

I need to connect to the db and check for certain info in certain rows. Then by using the if function, processing different code depending on what come back from the db (if the info is correct and is in the correct row, process x code and if the info is not correct in the db, process y code.)

^^thats the query i’m trying to run^^

I have it all working other then the actual connecting to the db part as my hosting provider has blocked it. They told me to use http (as explained above) but i have no idea how to do so.

Can anyone explain (in English please) how i would use http to do something like this? Or better, an easier solution?

I cant change hosting providers….

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:17:09+00:00Added an answer on May 24, 2026 at 2:17 am

    You can use CURL to request that php page on another server and then process the response.

    Example of creating curl request

    $encoded = ''; // include GET variables foe example. POST will be similar
    foreach($_GET as $name => $value) {
      $encoded .= urlencode($name).'='.urlencode($value).'&';
    }
    // chop off last ampersand
    $encoded = substr($encoded, 0, strlen($encoded)-1)
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, "myOtherHostThatBlockedMysqlAccess.com/mysqlPage.php");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,  $encoded);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    $output = curl_exec($ch); 
    curl_close($ch);  
    

    So – what we do in the previous example – we request mysqlPage.php on the server that has access to your Mysql db. In that page – you’ll have to put your Mysql access logic.
    After you retrieve records from db – youll probably end up with some array like $someDbArray- you can serialize this array and simply echo it out:

    echo serialize($someDbArray);
    

    Whatever you echo out will be available to you inside of the $output variable that is the CURL output. So you can simply retireve your array like this:

    $myDataArray = unserialize(output);
    

    However – if you ask me – the best solution will be to get a hosting that doesn’t limit access from anywhere. I assume you’re using shared hosting? I’d switch to at least VPN or dedicated server. I mean – either way you go – via REST or CURL – latency will be tremendous. Also – I’m not sure what kind of data you’ll be transfering but think of a security. You’ll have to use https at the very least.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.