Jump to content

Recommended Posts

I'm trying to help a client out here.  This is typically out of my domain, but the forum's been great in the past.

 

Here's what we're trying to do, but don't know how to in PHP.

 

1. I have a URL string where the client needs to include some variable information.

test.abc.com:8080?variable1=9899&variable2=09oid&variable3=Y

 

2. What comes back is either a YES or a NO

 

3. The code will branch accordingly.

 

My question is what is the best approach to connect to the site?  I've done a little research and found a couple of alternatives -- fsockopen, fopen, GET/HTTP.  The partner can't get what he's coded and wanted to know if he's just barking up the wrong tree. 

 

Just looking for a recommended approach here.  Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/85303-solved-retrieving-info-from-http-get/
Share on other sites

Hi,

 

I have done these kind of functionality where i have to call a url with arguments and i will get the response accordingly .I have used fsockopen() in these secnarios many a times. But yes you can also explore CURL lib also.i think both are good .

 

Regards

$url = 'test.abc.com:8080?variable1=9899&variable2=09oid&variable3=Y'; //send certain variables
$output = file_get_contents($url); //request the page through HTTP GET
echo $output; //get your YES or NO

 

 

file_get_contents() is optimized to be better/faster than fopen() in simple cases like HTTP GET

Read the manual.

URL Wrappers must be ON to access remote urls

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.