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 1096447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:17:09+00:00 2026-05-17T00:17:09+00:00

I have a simple PHP function on a friend server which I’ve checked and

  • 0

I have a simple PHP function on a friend server which I’ve checked and has PHP CURL enabled.

The function is:

function sw_fetch_code($apikey='',$email=''){

 $url = "http://www.domain.com/xxx/api.php?getcode=1&apikey=".$apikey."&email=".$email."";


        $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_HEADER, 1); 
 $result = curl_exec($ch);

 curl_close($ch);

 $obj = json_decode($result);  

 if(!empty($obj)){
  if($obj->status == 200){

   return $obj->code;

  }else{
   return $obj->status;
  }
 }

}

As you can see this is very simple and I’ve tested it and works on localhost and internal to my own server. The url returns as expected. However it just doesn’t give any response when this function is called on my friends server.

Any ideas what could cause this?

  • 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-17T00:17:10+00:00Added an answer on May 17, 2026 at 12:17 am

    First :
    check from the “friend” server if the URL works, as you donot have POST params, you can check with the exact query and get expected results. See if you can get the results on the browser on the friend server. If you don’t have a GUI try wget on the command line. See if you get results. If you do go to next step, if you don’t cURL isn’t the problem. “friend server” isn’t able to see your domain. Could be network issue / hosts etc .. (more on that if its the case)

    Second:
    If you see results on step 1. Try this and see if you get anything:

    $handle = fopen($url, "rb");
        $contents = '';
    while (!feof($handle)) {
        $contents .= fread($handle,1024);
    }
    

    If you get response to this, then there is something wrong with cURL.

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

Sidebar

Related Questions

I have simple script which contains two pages - script.php and function.php. Script.php contains
I have a PHP file with one simple echo function: echo 'アクセスは撥ねりません。'; but when
I have a simple php script on my domain that sends me an email:
Here I have a simple php script which displays some values from a database
I have a simple PHP function that will grab information from a database based
I have a simple update set php sql function on my site where I
I have a simple function, which I'm trying to turn turn into a query.
I have a simple example of PHP sessions and AJAX, which works when holding
i have simple form that uploads image to server and returns php string containing
I have this simple PHP function in admin.php function accountMenu() { if (isset($_SESSION['user_id'])) {

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.