# web\_API post to php file on server not working

**URL:** <https://community.thunkable.com/t/web-api-post-to-php-file-on-server-not-working/590642>\
**Category:** Questions about Thunkable X\
**Created:** [May 28, 2020, 2:54pm UTC](https://community.thunkable.com/t/web-api-post-to-php-file-on-server-not-working/590642 "2020-05-28T14:54:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![captainzee9999jf](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@captainzee9999jf](https://community.thunkable.com/u/captainzee9999jf)\
**Post date:** [May 28, 2020, 2:54pm UTC](https://community.thunkable.com/t/web-api-post-to-php-file-on-server-not-working/590642/1 "2020-05-28T14:54:51Z")

</div>

I am having trouble getting thunkable x to Post data to my php file.

I have a basic php file on my web server which returns the posted value.  
I’ve created a block in AppInventor2 shown below which works fine

 ![ai2blocks](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/a/7aec7a585d4ceea3be93b316b735fa727bd19fee.png)

this gives me the result ‘Fred-ok’

I have created a similar block in Thunkable shown here  
 ![thunkableblocks](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/1/91d1ab46c91cb42f066d4c857419ea1c9a514858.png)

this just gives back the result ‘-ok’

i have added the header and query in the design page  
 ![thunkabledesign](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/f/efeb4abab792cb25090a5dffe5401627ec28ca5f.png)

and have tried it using the header and query blocks but still cannot get the php code to see the post value

the php code looks like this

![Untitled](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/7/7706e2da80b9d993e0d8168f59cbc0bec78221d6.png)

I have tried some variations like putting the application/x-www-form-urlencoded in the body as shown in the scrWebApi sample but cannot seem to find the solution

any help would be greatly appreciated

thanks

---

<div class="post-metadata">

**Author:** ![captainzee9999jf](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@captainzee9999jf](https://community.thunkable.com/u/captainzee9999jf)\
**Post date:** [May 31, 2020, 3:08pm UTC](https://community.thunkable.com/t/web-api-post-to-php-file-on-server-not-working/590642/2 "2020-05-31T15:08:46Z")

</div>

Tried searching the forums, tried multiple solutions using text or json with still no luck, nothing seems to work so im starting to think there is a bug in the post block

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [May 31, 2020, 3:21pm UTC](https://community.thunkable.com/t/web-api-post-to-php-file-on-server-not-working/590642/3 "2020-05-31T15:21:36Z")

</div>

Check example on scrWebApi in

[https://x.thunkable.com/projects/5d70f93f8a62b4079eedaff2/project/properties/designer/](https://x.thunkable.com/projects/5d70f93f8a62b4079eedaff2/project/properties/designer/)

---

<div class="post-metadata">

**Author:** ![captainzee9999jf](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@captainzee9999jf](https://community.thunkable.com/u/captainzee9999jf)\
**Post date:** [May 31, 2020, 3:58pm UTC](https://community.thunkable.com/t/web-api-post-to-php-file-on-server-not-working/590642/4 "2020-05-31T15:58:46Z")

</div>

thanks, i have looked at your scrWebApi but have not managed to modifiy it so it works with my basic php code

could you explain what is going on in your code, you use webviewer and web\_api, do you think i should post with webviewer how what blocks should i be using

my final plan is to post several pieces of information to my php script at once, email, password, text info etc

thanks for any help you can give me

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 1, 2020, 7:24am UTC](https://community.thunkable.com/t/web-api-post-to-php-file-on-server-not-working/590642/5 "2020-06-01T07:24:45Z")

</div>

Pay attention to how you need to get data correctly in the PHP script (use **isset**!).

![изображение](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/5/95ac83c4e6347e37f68828f5f78b9ea2f36737d2.png)

```
<?
	echo "worked";
	if(isset($_POST['search'])) {
		$value = $_POST['search'];
		echo '----'.$value;
	}
?>
```

---

<div class="post-metadata">

**Author:** ![captainzee9999jf](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@captainzee9999jf](https://community.thunkable.com/u/captainzee9999jf)\
**Post date:** [June 1, 2020, 12:00pm UTC](https://community.thunkable.com/t/web-api-post-to-php-file-on-server-not-working/590642/6 "2020-06-01T12:00:52Z")

</div>

thank you ever so much, that is exactly what ive been looking for.

the php code works fine as it is but will add the isset check in the proper code

many beers to you

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:28am UTC](https://community.thunkable.com/t/web-api-post-to-php-file-on-server-not-working/590642/7 "2024-11-08T11:28:51Z")

</div>


