Below is my code used to Get data from a REST API to retrieve States .The results contain the State code and State Name to be passed into a select option form with State code as Key and State name as value . My challenge is , i am unable to know the right way to access the data after
Tag: curl
PHP curl strange behavior PUT vs. POST
One of my projects contains an interface to a web based database, which I call using curl. A curl with -X PUT will create a new record, a curl with -X POST will update an existing record. If I perform this using Advanced REST Client, it works as it should. If I try this using a call of curl_exec out
PHP: CURL fails to save cookie
I am using PHP from one host to connect to the API of another on the same subnet, which requires cookies to remember the login. It gives me a WARNING: failed to save cookies in /var/includes/cookie. I set up a short test script for myself as follows: The verbose log file gives me this output: The contents of $output itself
2ba web API post request with php curl
Im using 2ba its API to receive product information which I later on want to store inside my database. I am trying to create a post request for receiving the data I need. This is the request I want to get to working. And this is my code: postApiData.php index.php My API key does for sure work since I have
Check proxy before cURL
I need to check whether the selected $proxy is active or not and do a loop until a working one in proxy.txt is found before using it in a cURL. How could I do that? Below is a given proxy function. Thank you. Answer maybe you can ping, something like this
Extract links from a list of urls
I am trying to extract all the links from a set list of or urls in a text file and save the extracted links in another text file. I am trying to use the script below which was originally meant to extract Emails: I changed the the email extract part to extract links like this: Here is the full code:
PHP opens and closes file, but does not write anything to it
I have spent a couple of hours reading up on this but as so yet I find no clear solutions….I am using WAMP to run as my Local server. I have a successful API call set up to return data. I would …
API working well on POSTMAN but giving error in Curl PHP
I am trying to fetch the record from the api. It’s working correctly on postman but giving the error when I use curl in php. Here is my PHP Code: Here is the error I am getting after curl: error after curl option On the Postman it’s giving the result perfect as expected: postman result Furthermore api url working perfect
PHP Notice: Trying to get property ‘id’ of non-object. How to resolve?
I am using cURL and PHP to make a request to a test API to return a list of users but I get the following error: PHP Notice: Trying to get property ‘id’ of non-object Not sure where I am going wrong. Here is my code Answer you have to loop through the response:
Refreshing Instagram long-lived access token works in browser (http) but not PHP (curl)
hope you can help. I’m trying to implement Instagram’s Basic Display API but unfortunately I’m running into problems generating a long-lived access token or refreshing an existing long-lived token using PHP/cURL. It seems I’m far from the only one having this or similar issues. I followed Facebooks getting-started guide (located here) and was able to generate a short-lived access token,