Jump to content

Recommended Posts

hey guys, I have this script that posts data to another page and expects an output. I'm using file_get_contents and I get this message:

 

Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /../../ on line 71

 

Warning: file_get_contents(http://../../) [function.file-get-contents]: failed to open stream: Success in /../../../ on line 71

 

could it be the server setting or version of php? but the page exists and works fine.

any ideas?

Link to comment
https://forums.phpfreaks.com/topic/176636-file_get_contents-not-working/
Share on other sites

here is the preceding code

 

$data=array('variable_1'=>$_REQUEST['x1'],'variable_2'=>$_REQUEST['x2']);
$data=http_build_query($data);
$context_options=array('http'=>array('method'=>'POST',
         'header'=>"Content-type: application/x-www-form-urlencoded\r\n".
         'Content-Length: '.strlen($data)."\r\n",
         'content'=>$data));
$context=stream_context_create($context_options);

$fp=file_get_contents('http://mysite.com/page.php', FALSE, $context);

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.