Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
Like Tree5Likes

Thread: How to connect to a URL in PHP?

  1. #1
    Member
    Join Date
    Feb 2017
    Location
    India
    Posts
    35
    Member #
    56118
    Liked
    2 times

    How to connect to a URL in PHP?

    How to connect to a URL in PHP?

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,377
    Member #
    5580
    Liked
    674 times
    I'm not sure what you mean by "connect".

    You can use PHP to open a URL and read its HTML source.
    You can use PHP to query, or request, information from someone's API.

    If you own both sites, you can have PHP on both that exchange data back and forth.

    What are you trying to do? Describe what "connect" means to you.
    apptunix1 likes this.


  4. #3
    Member
    Join Date
    Feb 2017
    Location
    India
    Posts
    35
    Member #
    56118
    Liked
    2 times
    I want through my project to create a cron script to connect to another server that has a remote url:

  5. #4
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,522
    Member #
    425
    Liked
    2783 times
    Are you referring to cURL?
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  6. #5
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,377
    Member #
    5580
    Liked
    674 times
    The "other server" .... what is the PHP script supposed to do with the other server?

    Not enough information to answer your question.


  7. #6
    Member
    Join Date
    Feb 2017
    Location
    India
    Posts
    35
    Member #
    56118
    Liked
    2 times
    How to manage the PHP script with cURL? because i don't have the knowledge of cURL

  8. #7
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,377
    Member #
    5580
    Liked
    674 times
    cURL is a method to either GET or POST data to another URL. The other URL must be able to accept the POST or GET and do something with the data. If it is an API, then it's designed specifically for doing that. If it's a website you own, then you can write scripts to accept or exchange data using cURL. If it's someone else's website and you are not supposed to be "connecting", or whatever you're doing, then you should not be asking.

    What specifically are you GETTING or POSTING? And to whom? And for what reason?


  9. #8
    Member
    Join Date
    Feb 2017
    Location
    India
    Posts
    35
    Member #
    56118
    Liked
    2 times
    Thanks for providing me a informative information ......... But i want to know ......Can i fetch the data from other's site with cURL ? Is it possible ?

  10. #9
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,522
    Member #
    425
    Liked
    2783 times
    If they allow you to do it, yes. That's what cURL does.

    Whether or not they allow you to do it is up to them, though. We can't speculate on that.
    apptunix1 likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  11. #10
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,377
    Member #
    5580
    Liked
    674 times
    With curl, you can read another site's html source and then parse the html for information. That's called "scraping". It isn't ethical because you are really taking someone else's information without permission. But, that is one way to use curl. If they offer an API, then you will use curl to get valid permissible information.

    Give me a URL or some website where you want to use curl ... We might be able to give you an example.
    apptunix1 likes this.



Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:52 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com